use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition in project records-management by Alfresco.
the class RMv22GhostOnDestroyDispositionActionPatch method processDispositionSchedule.
/**
* Patch the specified disposition schedule. To do this add the host on
* destroy to any action definition that doesn't already have it defined and
* set the value to the value set in the global properties file. Leave any
* action definitions that have this property already defined untouched.
*
* @param dispositionSchedule
*/
private void processDispositionSchedule(DispositionSchedule dispositionSchedule) {
List<DispositionActionDefinition> actionDefinitions = dispositionSchedule.getDispositionActionDefinitions();
for (DispositionActionDefinition actionDefinition : actionDefinitions) {
String actionName = (String) nodeService.getProperty(actionDefinition.getNodeRef(), RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME);
if ("destroy".equals(actionName)) {
// we only want to add the ghost on destroy property to action
// definitions that do not already have it defined
String ghostOnDestroyValue = (String) nodeService.getProperty(actionDefinition.getNodeRef(), RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY);
if (ghostOnDestroyValue == null) {
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, this.ghostingEnabled ? "ghost" : "destroy");
this.dispositionService.updateDispositionActionDefinition(actionDefinition, props);
}
}
}
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition in project records-management by Alfresco.
the class BroadcastDispositionActionDefinitionUpdateActionUnitTest method testPersistPeriodChanges.
/**
* Check that the disposition service is used to determine the "disposition as of" date when changes are made to the
* disposition period.
*/
@Test
public void testPersistPeriodChanges() {
// Set up the data associated with the next disposition action.
DispositionAction mockAction = mock(DispositionAction.class);
when(mockAction.getNodeRef()).thenReturn(NEXT_ACTION_NODE_REF);
DispositionActionDefinition mockDispositionActionDefinition = mock(DispositionActionDefinition.class);
when(mockAction.getDispositionActionDefinition()).thenReturn(mockDispositionActionDefinition);
when(mockAction.getName()).thenReturn("mockAction");
// Set up the disposition service to return a known "disposition as of" date.
Date asOfDate = new Date();
when(mockDispositionService.calculateAsOfDate(CONTENT_NODE_REF, mockDispositionActionDefinition)).thenReturn(asOfDate);
// Call the method under test.
action.persistPeriodChanges(DISPOSITION_ACTION_DEF_NODE, mockAction);
// Check that the "disposition as of" date has been set on the next action.
verify(mockNodeService).setProperty(NEXT_ACTION_NODE_REF, PROP_DISPOSITION_AS_OF, asOfDate);
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition in project records-management by Alfresco.
the class DispositionServiceImplTest method updateDispositionScheduleOnContainer.
private void updateDispositionScheduleOnContainer(NodeRef nodeRef) {
Map<QName, Serializable> updateProps = new HashMap<QName, Serializable>(3);
updateProps.put(PROP_DISPOSITION_PERIOD, "week|1");
updateProps.put(PROP_DISPOSITION_EVENT, (Serializable) Arrays.asList(CommonRMTestUtils.DEFAULT_EVENT_NAME, "abolished"));
DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef);
DispositionActionDefinition dad = ds.getDispositionActionDefinitionByName("cutoff");
dispositionService.updateDispositionActionDefinition(dad, updateProps);
publishDispositionActionDefinitionChange(dad);
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition in project records-management by Alfresco.
the class DispositionServiceImplTest method checkDispositionSchedule.
/**
* Checks a disposition schedule
*
* @param ds disposition scheduleS
*/
private void checkDispositionSchedule(DispositionSchedule ds, String dispositionInstructions, String dispositionAuthority, boolean isRecordLevel) {
assertEquals(dispositionAuthority, ds.getDispositionAuthority());
assertEquals(dispositionInstructions, ds.getDispositionInstructions());
assertEquals(isRecordLevel, ds.isRecordLevelDisposition());
List<DispositionActionDefinition> defs = ds.getDispositionActionDefinitions();
assertNotNull(defs);
assertEquals(2, defs.size());
DispositionActionDefinition defCutoff = ds.getDispositionActionDefinitionByName("cutoff");
assertNotNull(defCutoff);
assertEquals("cutoff", defCutoff.getName());
DispositionActionDefinition defDestroy = ds.getDispositionActionDefinitionByName("destroy");
assertNotNull(defDestroy);
assertEquals("destroy", defDestroy.getName());
}
Aggregations