mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. 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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user