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
This commit is contained in:
Tuna Aksoy
2013-08-16 19:07:16 +00:00
parent 2507a6b7ce
commit 72b00c8548
2 changed files with 26 additions and 24 deletions

View File

@@ -129,13 +129,13 @@
<property name="permission" value="FileDestructionReport" /> <!-- Associated permission --> <property name="permission" value="FileDestructionReport" /> <!-- Associated permission -->
<property name="kinds"> <property name="kinds">
<list> <list>
<value>RECORD</value> <!-- Only applies to records and record folders --> <value>RECORD</value> <!-- Only applies to records and record folders -->
<value>RECORD_FOLDER</value> <value>RECORD_FOLDER</value>
</list> </list>
</property> </property>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.filling" value="true"/> <!-- Must have read and file permissions --> <entry key="capabilityCondition.filling" value="true"/> <!-- Must have read and file permissions -->
<entry key="capabilityCondition.frozen" value="false"/> <!-- Not for frozen records --> <entry key="capabilityCondition.frozen" value="false"/> <!-- Not for frozen records -->
<entry key="capabilityCondition.destroyed" value="true"/> <!-- Only for destroyed things --> <entry key="capabilityCondition.destroyed" value="true"/> <!-- Only for destroyed things -->
</map> </map>
@@ -226,6 +226,7 @@
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.cutoff" value="false"/> <entry key="capabilityCondition.cutoff" value="false"/>
<entry key="capabilityCondition.cutoffIsScheduled" value="true" />
</map> </map>
</property> </property>
</bean> </bean>
@@ -249,6 +250,7 @@
<map> <map>
<entry key="capabilityCondition.cutoff" value="true"/> <entry key="capabilityCondition.cutoff" value="true"/>
<entry key="capabilityCondition.isTransferring" value="false" /> <entry key="capabilityCondition.isTransferring" value="false" />
<entry key="capabilityCondition.lastDispositionActionCutoff" value="true"/>
</map> </map>
</property> </property>
</bean> </bean>

View File

@@ -29,14 +29,14 @@ import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* UnCutoff action implementation * UnCutoff action implementation
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class UnCutoffAction extends RMActionExecuterAbstractBase public class UnCutoffAction extends RMActionExecuterAbstractBase
{ {
/** I18N */ /** I18N */
private static final String MSG_UNDO_NOT_LAST = "rm.action.undo-not-last"; 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) * @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 // Get the last disposition action
DispositionAction da = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef); DispositionAction da = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef);
// Check that the last disposition action was a cutoff // Check that the last disposition action was a cutoff
if (da == null || da.getName().equals("cutoff") == false) if (da == null || da.getName().equals("cutoff") == false)
{ {
// Can not undo cut off since cut off was not the last thing done // Can not undo cut off since cut off was not the last thing done
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDO_NOT_LAST)); 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 // Remove the cutoff aspect
nodeService.removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF); nodeService.removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF);
if (recordsManagementService.isRecordFolder(actionedUponNodeRef) == true) if (recordsManagementService.isRecordFolder(actionedUponNodeRef) == true)
@@ -82,6 +66,22 @@ public class UnCutoffAction extends RMActionExecuterAbstractBase
nodeService.removeAspect(record, ASPECT_CUT_OFF); 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);
} }
} }
} }