From facd631ccee4836f812fba5f98a4a3c722206971 Mon Sep 17 00:00:00 2001 From: David Caruana Date: Fri, 16 Dec 2005 13:58:25 +0000 Subject: [PATCH] Fix renaming of 'Company Home' and other system folders such as Data Dictionary - AR-318 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2045 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../model-specific-services-context.xml | 9 ++++ .../filefolder/FileFolderServiceImpl.java | 48 ++++++++++++++++--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/config/alfresco/model-specific-services-context.xml b/config/alfresco/model-specific-services-context.xml index 2ae11ec15d..ebf53a1f6d 100644 --- a/config/alfresco/model-specific-services-context.xml +++ b/config/alfresco/model-specific-services-context.xml @@ -12,6 +12,15 @@ + + + + /${spaces.company_home.childname} + /${spaces.company_home.childname}/${spaces.dictionary.childname} + /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname} + /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname} + + diff --git a/source/java/org/alfresco/repo/model/filefolder/FileFolderServiceImpl.java b/source/java/org/alfresco/repo/model/filefolder/FileFolderServiceImpl.java index bb797f8013..a717802b40 100644 --- a/source/java/org/alfresco/repo/model/filefolder/FileFolderServiceImpl.java +++ b/source/java/org/alfresco/repo/model/filefolder/FileFolderServiceImpl.java @@ -98,6 +98,9 @@ public class FileFolderServiceImpl implements FileFolderService private ContentService contentService; private MimetypeService mimetypeService; + // TODO: Replace this with a more formal means of identifying "system" folders (i.e. aspect or UUID) + private List systemPaths; + /** * Default constructor */ @@ -140,6 +143,13 @@ public class FileFolderServiceImpl implements FileFolderService this.mimetypeService = mimetypeService; } + // TODO: Replace this with a more formal means of identifying "system" folders (i.e. aspect or UUID) + public void setSystemPaths(List systemPaths) + { + this.systemPaths = systemPaths; + } + + public void init() { PARAMS_ANY_NAME[0] = new QueryParameterDefImpl( @@ -481,13 +491,22 @@ public class FileFolderServiceImpl implements FileFolderService NodeRef targetNodeRef = null; if (move) { - // move the node so that the association moves as well - ChildAssociationRef newAssocRef = nodeService.moveNode( - sourceNodeRef, - targetParentRef, - assocRef.getTypeQName(), - qname); - targetNodeRef = newAssocRef.getChildRef(); + // TODO: Replace this with a more formal means of identifying "system" folders (i.e. aspect or UUID) + if (!isSystemPath(sourceNodeRef)) + { + // move the node so that the association moves as well + ChildAssociationRef newAssocRef = nodeService.moveNode( + sourceNodeRef, + targetParentRef, + assocRef.getTypeQName(), + qname); + targetNodeRef = newAssocRef.getChildRef(); + } + else + { + // system path folders do not need to be moved + targetNodeRef = sourceNodeRef; + } } else { @@ -515,6 +534,21 @@ public class FileFolderServiceImpl implements FileFolderService return afterFileInfo; } + /** + * Determine if the specified node is a special "system" folder path based node + * + * TODO: Replace this with a more formal means of identifying "system" folders (i.e. aspect or UUID) + * + * @param nodeRef node to check + * @return true => system folder path based node + */ + private boolean isSystemPath(NodeRef nodeRef) + { + Path path = nodeService.getPath(nodeRef); + String prefixedPath = path.toPrefixString(namespaceService); + return systemPaths.contains(prefixedPath); + } + public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException { // file or folder