. Implemented 'rename' for AVM files/folders

- this has highlighted some interesting future issues with AVM NodeRef objects - as unlike the usual noderefs, they can change due to a rename or move!
. Fixed issue with navigating back to details and browse screens after a delete file/folder operation

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4004 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-10-03 11:49:37 +00:00
parent 1c6e3a68f0
commit 2d261f31f7
13 changed files with 615 additions and 427 deletions

View File

@@ -20,6 +20,8 @@ import java.text.MessageFormat;
import javax.faces.context.FacesContext;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.web.app.Application;
@@ -35,6 +37,7 @@ import org.alfresco.web.bean.repository.Repository;
public class EditFilePropertiesDialog extends EditContentPropertiesDialog
{
protected AVMBrowseBean avmBrowseBean;
protected AVMService avmService;
// ------------------------------------------------------------------------------
@@ -48,6 +51,14 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog
this.avmBrowseBean = avmBrowseBean;
}
/**
* @param avmService The AVMService to set.
*/
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
// ------------------------------------------------------------------------------
// Dialog implementation
@@ -64,6 +75,13 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog
@Override
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
// a rename may have occured - we need to reset the NodeRef of the modified AVM Node
// as an AVM NodeRef contains the name as part of ref - which can therefore change!
String name = this.editableNode.getName();
String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond();
String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name;
this.avmBrowseBean.setAvmNode(new AVMNode(this.avmService.lookup(-1, newPath)));
return outcome;
}