RM-3386 Persist the fact that an "as of" date has been manually set.

If a "disposition as of" date is manually set using "Edit Retention Date"
then don't update it when changing the disposition schedule steps. Use a
new property to store the fact that the "disposition as of" date has been
manually set.
This commit is contained in:
Tom Page
2016-10-14 15:23:46 +01:00
parent 0100e01a0b
commit c8577fe90c
5 changed files with 19 additions and 2 deletions

View File

@@ -392,6 +392,11 @@
<type>d:date</type> <type>d:date</type>
<mandatory>false</mandatory> <mandatory>false</mandatory>
</property> </property>
<property name="rma:manuallySetAsOf">
<title>Manually Set Disposition Date Flag</title>
<type>d:boolean</type>
<default>false</default>
</property>
<property name="rma:dispositionEventsEligible"> <property name="rma:dispositionEventsEligible">
<title>Disposition Events Eligible</title> <title>Disposition Events Eligible</title>
<type>d:boolean</type> <type>d:boolean</type>

View File

@@ -18,6 +18,8 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.action.impl; package org.alfresco.module.org_alfresco_module_rm.action.impl;
import static org.apache.commons.lang3.BooleanUtils.isNotTrue;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@@ -185,7 +187,8 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
{ {
// the change does effect the nextAction for this node // the change does effect the nextAction for this node
// so go ahead and determine what needs updating // so go ahead and determine what needs updating
if (changedProps.contains(PROP_DISPOSITION_PERIOD)) if (changedProps.contains(PROP_DISPOSITION_PERIOD)
&& isNotTrue((Boolean) getNodeService().getProperty(nextAction.getNodeRef(), PROP_MANUALLY_SET_AS_OF)))
{ {
persistPeriodChanges(dispositionActionDef, nextAction); persistPeriodChanges(dispositionActionDef, nextAction);
} }

View File

@@ -62,6 +62,7 @@ public class EditDispositionActionAsOfDateAction extends RMActionExecuterAbstrac
if (da != null) if (da != null)
{ {
getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate); getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate);
getNodeService().setProperty(da.getNodeRef(), PROP_MANUALLY_SET_AS_OF, true);
} }
} }
else else

View File

@@ -18,6 +18,8 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.disposition.property; package org.alfresco.module.org_alfresco_module_rm.disposition.property;
import static org.apache.commons.lang3.BooleanUtils.isNotTrue;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@@ -211,7 +213,11 @@ public class DispositionProperty extends BaseBehaviourBean
// update asOf date on the disposition action based on the new property value // update asOf date on the disposition action based on the new property value
NodeRef daNodeRef = dispositionAction.getNodeRef(); NodeRef daNodeRef = dispositionAction.getNodeRef();
nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf); // Don't overwrite a manually set "disposition as of" date.
if (isNotTrue((Boolean) nodeService.getProperty(daNodeRef, PROP_MANUALLY_SET_AS_OF)))
{
nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf);
}
} }
} }
} }

View File

@@ -149,6 +149,8 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
QName PROP_DISPOSITION_ACTION_ID = QName.createQName(RM_URI, "dispositionActionId"); QName PROP_DISPOSITION_ACTION_ID = QName.createQName(RM_URI, "dispositionActionId");
QName PROP_DISPOSITION_ACTION = QName.createQName(RM_URI, "dispositionAction"); QName PROP_DISPOSITION_ACTION = QName.createQName(RM_URI, "dispositionAction");
QName PROP_DISPOSITION_AS_OF = QName.createQName(RM_URI, "dispositionAsOf"); QName PROP_DISPOSITION_AS_OF = QName.createQName(RM_URI, "dispositionAsOf");
/** A flag indicating that the "disposition as of" date has been manually set and shouldn't be changed. */
QName PROP_MANUALLY_SET_AS_OF = QName.createQName(RM_URI, "manuallySetAsOf");
QName PROP_DISPOSITION_EVENTS_ELIGIBLE = QName.createQName(RM_URI, "dispositionEventsEligible"); QName PROP_DISPOSITION_EVENTS_ELIGIBLE = QName.createQName(RM_URI, "dispositionEventsEligible");
QName PROP_DISPOSITION_ACTION_STARTED_AT = QName.createQName(RM_URI, "dispositionActionStartedAt"); QName PROP_DISPOSITION_ACTION_STARTED_AT = QName.createQName(RM_URI, "dispositionActionStartedAt");
QName PROP_DISPOSITION_ACTION_STARTED_BY = QName.createQName(RM_URI, "dispositionActionStartedBy"); QName PROP_DISPOSITION_ACTION_STARTED_BY = QName.createQName(RM_URI, "dispositionActionStartedBy");