mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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
This commit is contained in:
@@ -12,6 +12,15 @@
|
|||||||
<property name="searchService"><ref bean="SearchService" /></property>
|
<property name="searchService"><ref bean="SearchService" /></property>
|
||||||
<property name="contentService"><ref bean="contentService" /></property>
|
<property name="contentService"><ref bean="contentService" /></property>
|
||||||
<property name="mimetypeService"><ref bean="mimetypeMap" /></property>
|
<property name="mimetypeService"><ref bean="mimetypeMap" /></property>
|
||||||
|
|
||||||
|
<property name="systemPaths">
|
||||||
|
<list>
|
||||||
|
<value>/${spaces.company_home.childname}</value>
|
||||||
|
<value>/${spaces.company_home.childname}/${spaces.dictionary.childname}</value>
|
||||||
|
<value>/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}</value>
|
||||||
|
<value>/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -98,6 +98,9 @@ public class FileFolderServiceImpl implements FileFolderService
|
|||||||
private ContentService contentService;
|
private ContentService contentService;
|
||||||
private MimetypeService mimetypeService;
|
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
|
* Default constructor
|
||||||
*/
|
*/
|
||||||
@@ -140,6 +143,13 @@ public class FileFolderServiceImpl implements FileFolderService
|
|||||||
this.mimetypeService = mimetypeService;
|
this.mimetypeService = mimetypeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Replace this with a more formal means of identifying "system" folders (i.e. aspect or UUID)
|
||||||
|
public void setSystemPaths(List<String> systemPaths)
|
||||||
|
{
|
||||||
|
this.systemPaths = systemPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
PARAMS_ANY_NAME[0] = new QueryParameterDefImpl(
|
PARAMS_ANY_NAME[0] = new QueryParameterDefImpl(
|
||||||
@@ -480,6 +490,9 @@ public class FileFolderServiceImpl implements FileFolderService
|
|||||||
// move or copy
|
// move or copy
|
||||||
NodeRef targetNodeRef = null;
|
NodeRef targetNodeRef = null;
|
||||||
if (move)
|
if (move)
|
||||||
|
{
|
||||||
|
// 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
|
// move the node so that the association moves as well
|
||||||
ChildAssociationRef newAssocRef = nodeService.moveNode(
|
ChildAssociationRef newAssocRef = nodeService.moveNode(
|
||||||
@@ -490,6 +503,12 @@ public class FileFolderServiceImpl implements FileFolderService
|
|||||||
targetNodeRef = newAssocRef.getChildRef();
|
targetNodeRef = newAssocRef.getChildRef();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// system path folders do not need to be moved
|
||||||
|
targetNodeRef = sourceNodeRef;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// copy the node
|
// copy the node
|
||||||
targetNodeRef = copyService.copy(
|
targetNodeRef = copyService.copy(
|
||||||
@@ -515,6 +534,21 @@ public class FileFolderServiceImpl implements FileFolderService
|
|||||||
return afterFileInfo;
|
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
|
public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException
|
||||||
{
|
{
|
||||||
// file or folder
|
// file or folder
|
||||||
|
Reference in New Issue
Block a user