From 187d0af93bf7796179922cdbe95ead65ff60d516 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Thu, 14 Mar 2013 02:42:53 +0000 Subject: [PATCH] RM: Rejected records bug fixes * ensure all the record information is removed from a rejected record (seeing issue with ID being reset) * rejected records are ignored by the create record action * note: there are still some features we need to add to expand the rejected records use case git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@48064 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../rm-capabilities-group-context.xml | 22 +++++++++--- .../rm-ui-evaluators-context.xml | 2 +- .../action/dm/CreateRecordAction.java | 8 +++++ .../record/RecordServiceImpl.java | 35 ++++++++++--------- 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml index 527562e5e5..2cb51697b7 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml @@ -124,10 +124,14 @@ parent="declarativeCapability"> + + + RECORD + + - @@ -137,10 +141,14 @@ parent="declarativeCapability"> + + + RECORD_FOLDER + + - - + @@ -149,10 +157,14 @@ parent="declarativeCapability"> + + + RECORD_CATEGORY + + - - + diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml index e4ca5acb79..dee0252ef8 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml @@ -229,7 +229,7 @@ RECORD - + () @@ -526,6 +526,9 @@ public class RecordServiceImpl implements RecordService, // take note of the record id String recordId = (String)nodeService.getProperty(nodeRef, PROP_IDENTIFIER); + // take node of the original document owner + String documentOwner = (String) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_USER_ID); + // first remove the secondary link association NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); List parentAssocs = nodeService.getParentAssocs(nodeRef); @@ -537,23 +540,24 @@ public class RecordServiceImpl implements RecordService, break; } } - - // remove the "record" and "file plan component" aspects - nodeService.removeAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD); - nodeService.removeAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT); - - // remove "identifier" property - nodeService.removeProperty(nodeRef, PROP_IDENTIFIER); - + + // remove all RM related aspects from the node + Set aspects = nodeService.getAspects(nodeRef); + for (QName aspect : aspects) + { + if (RM_URI.equals(aspect.getNamespaceURI()) == true) + { + // remove the aspect + nodeService.removeAspect(nodeRef, aspect); + } + } + // get the records primary parent association ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); // move the record into the collaboration site nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName()); - - // remove all extended readers - extendedSecurityService.removeAllExtendedSecurity(nodeRef); - + // save the information about the rejection details Map aspectProperties = new HashMap(3); aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId); @@ -561,8 +565,7 @@ public class RecordServiceImpl implements RecordService, aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason); nodeService.addAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS, aspectProperties); - // Restore the owner of the document - String documentOwner = (String) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_USER_ID); + // Restore the owner of the document if (StringUtils.isBlank(documentOwner)) { throw new AlfrescoRuntimeException("Unable to find the creator of document."); @@ -570,7 +573,7 @@ public class RecordServiceImpl implements RecordService, ownableService.setOwner(nodeRef, documentOwner); // send an email to the record creator - notificationHelper.recordRejectedEmailNotification(nodeRef, recordId); + notificationHelper.recordRejectedEmailNotification(nodeRef, recordId); return null; }