RM-623: Unable to rename record folder

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@47783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-03-08 03:58:24 +00:00
parent 3877220922
commit 24838caf0c
2 changed files with 49 additions and 75 deletions

View File

@@ -236,37 +236,4 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- Site Service -->
<!-- <bean id="siteService" class="org.alfresco.repo.site.ExtendedSiteServiceImpl" init-method="init">
<property name="nodeService" ref="NodeService"/>
<property name="directNodeService" ref="nodeService"/>
<property name="fileFolderService" ref="FileFolderService"/>
<property name="searchService" ref="SearchService"/>
<property name="namespaceService" ref="NamespaceService"/>
<property name="permissionService" ref="PermissionService"/>
<property name="authenticationContext" ref="authenticationContext"/>
<property name="personService" ref="PersonService"/>
<property name="activityService" ref="activityService"/>
<property name="taggingService" ref="TaggingService"/>
<property name="authorityService" ref="authorityService"/>
<property name="dictionaryService" ref="DictionaryService"/>
<property name="tenantAdminService" ref="tenantAdminService"/>
<property name="transactionHelper" ref="retryingTransactionHelper"/>
<property name="sitesXPath">
<value>./${spaces.company_home.childname}/st:sites</value>
</property>
<property name="tenantService" ref="tenantService"/>
<property name="roleComparator" ref="siteRoleComparator" />
<property name="sysAdminParams" ref="sysAdminParams"/>
<property name="behaviourFilter" ref="policyBehaviourFilter" />
<property name="sitesPermissionsCleaner" ref="sitesPermissionsCleaner"/>
<property name="cannedQueryRegistry" ref="siteCannedQueryRegistry"/>
<property name="policyComponent" ref="policyComponent"/>
<property name="publicServiceAccessService" ref="PublicServiceAccessService" />
<property name="recordsManagementService" ref="RecordsManagementService" />
</bean>
-->
</beans> </beans>

View File

@@ -119,22 +119,26 @@ public class RecordCopyBehaviours implements RecordsManagementModel
*/ */
public void onMoveRecordNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) public void onMoveRecordNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
{ {
final NodeRef newNodeRef = newChildAssocRef.getChildRef(); // check the records parent has actually changed
final NodeService nodeService = rmServiceRegistry.getNodeService(); if (oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) == false)
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{ {
public Object doWork() throws Exception final NodeRef newNodeRef = newChildAssocRef.getChildRef();
final NodeService nodeService = rmServiceRegistry.getNodeService();
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{ {
if (nodeService.exists(newNodeRef) == true) public Object doWork() throws Exception
{ {
// Remove unwanted aspects if (nodeService.exists(newNodeRef) == true)
removeUnwantedAspects(nodeService, newNodeRef); {
// Remove unwanted aspects
removeUnwantedAspects(nodeService, newNodeRef);
}
return null;
} }
}, AuthenticationUtil.getAdminUserName());
return null; }
}
}, AuthenticationUtil.getAdminUserName());
} }
/** /**
@@ -146,40 +150,43 @@ public class RecordCopyBehaviours implements RecordsManagementModel
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void onMoveRecordFolderNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) public void onMoveRecordFolderNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
{ {
final NodeRef newNodeRef = newChildAssocRef.getChildRef(); if (oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) == false)
final NodeService nodeService = rmServiceRegistry.getNodeService(); {
final RecordsManagementService rmService = rmServiceRegistry.getRecordsManagementService(); final NodeRef newNodeRef = newChildAssocRef.getChildRef();
final RecordsManagementActionService rmActionService = rmServiceRegistry.getRecordsManagementActionService(); final NodeService nodeService = rmServiceRegistry.getNodeService();
final RecordsManagementService rmService = rmServiceRegistry.getRecordsManagementService();
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() final RecordsManagementActionService rmActionService = rmServiceRegistry.getRecordsManagementActionService();
{
public Object doWork() throws Exception AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{ {
if (nodeService.exists(newNodeRef) == true) public Object doWork() throws Exception
{ {
// Remove unwanted aspects if (nodeService.exists(newNodeRef) == true)
removeUnwantedAspects(nodeService, newNodeRef); {
// Remove unwanted aspects
removeUnwantedAspects(nodeService, newNodeRef);
// TODO .. this isn't right!!
// .. what if the folder is in motion .. do we really want to lose all the disposition information?
// .. how do we merge from one disposition schedule to another
// .. for now throw unsupportedOperationException and refactor when considered
throw new UnsupportedOperationException("Moving a record folder is currently not supported.");
// // Trigger folder setup
// rmActionService.executeRecordsManagementAction(newNodeRef, "setupRecordFolder");
//
// // Sort out the child records
// for (NodeRef record : rmService.getRecords(newNodeRef))
// {
// removeUnwantedAspects(nodeService, record);
// rmActionService.executeRecordsManagementAction(record, "file");
// }
}
// TODO .. this isn't right!! return null;
// .. what if the folder is in motion .. do we really want to lose all the disposition information?
// .. how do we merge from one disposition schedule to another
// .. for now throw unsupportedOperationException and refactor when considered
throw new UnsupportedOperationException("Moving a record folder is currently not supported.");
// // Trigger folder setup
// rmActionService.executeRecordsManagementAction(newNodeRef, "setupRecordFolder");
//
// // Sort out the child records
// for (NodeRef record : rmService.getRecords(newNodeRef))
// {
// removeUnwantedAspects(nodeService, record);
// rmActionService.executeRecordsManagementAction(record, "file");
// }
} }
}, AuthenticationUtil.getAdminUserName());
return null; }
}
}, AuthenticationUtil.getAdminUserName());
} }
/** /**