From 72b00c85489519608dfdd10d33fe974a48065c40 Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Fri, 16 Aug 2013 19:07:16 +0000 Subject: [PATCH] RM-843 (Undo Cutoff is available after next disposition step is completed) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@54209 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../rm-capabilities-disposition-context.xml | 6 ++- .../action/impl/UnCutoffAction.java | 44 +++++++++---------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml index 478d35c3ce..eb27f3481c 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml @@ -129,13 +129,13 @@ - RECORD + RECORD RECORD_FOLDER - + @@ -226,6 +226,7 @@ + @@ -249,6 +250,7 @@ + diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java index 193cb3a54e..de8cb0c283 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java @@ -29,14 +29,14 @@ import org.springframework.extensions.surf.util.I18NUtil; /** * UnCutoff action implementation - * + * * @author Roy Wetherall */ public class UnCutoffAction extends RMActionExecuterAbstractBase -{ +{ /** I18N */ private static final String MSG_UNDO_NOT_LAST = "rm.action.undo-not-last"; - + /** * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) */ @@ -48,30 +48,14 @@ public class UnCutoffAction extends RMActionExecuterAbstractBase { // Get the last disposition action DispositionAction da = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef); - + // Check that the last disposition action was a cutoff if (da == null || da.getName().equals("cutoff") == false) { // Can not undo cut off since cut off was not the last thing done throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDO_NOT_LAST)); } - - // Delete the current disposition action - DispositionAction currentDa = dispositionService.getNextDispositionAction(actionedUponNodeRef); - if (currentDa != null) - { - nodeService.deleteNode(currentDa.getNodeRef()); - } - - // Move the previous (cutoff) disposition back to be current - nodeService.moveNode(da.getNodeRef(), actionedUponNodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); - - // Reset the started and completed property values - nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_AT, null); - nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_BY, null); - nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, null); - nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, null); - + // Remove the cutoff aspect nodeService.removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF); if (recordsManagementService.isRecordFolder(actionedUponNodeRef) == true) @@ -82,6 +66,22 @@ public class UnCutoffAction extends RMActionExecuterAbstractBase nodeService.removeAspect(record, ASPECT_CUT_OFF); } } + + // Delete the current disposition action + DispositionAction currentDa = dispositionService.getNextDispositionAction(actionedUponNodeRef); + if (currentDa != null) + { + nodeService.deleteNode(currentDa.getNodeRef()); + } + + // Move the previous (cutoff) disposition back to be current + nodeService.moveNode(da.getNodeRef(), actionedUponNodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); + + // Reset the started and completed property values + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_AT, null); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_BY, null); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, null); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, null); } - } + } } \ No newline at end of file