use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class LastDispositionActionCondition method evaluateImpl.
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public boolean evaluateImpl(NodeRef nodeRef) {
boolean result = false;
DispositionAction dispositionAction = dispositionService.getLastCompletedDispostionAction(nodeRef);
if (dispositionAction != null && dispositionActionName.equals(dispositionAction.getName())) {
result = true;
}
return result;
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class MoveRecordFolderTest method testMoveRecordFolderBeforeCutOffFolderLevelDisposition.
/**
* Given two categories, both with cut off immediately schedules, when the record is move then all the parts of the
* record should be correct based on the new schedule.
*
* @see https://issues.alfresco.com/jira/browse/RM-1345
*/
public void testMoveRecordFolderBeforeCutOffFolderLevelDisposition() throws Exception {
doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) {
NodeRef recordFolder;
NodeRef destinationRecordCategory;
public void given() {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
NodeRef rcOne = createRecordCategory(false);
destinationRecordCategory = createRecordCategory(false);
recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate());
// check for the lifecycle aspect
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
// check the disposition action details
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder);
assertNotNull(dispositionAction);
assertNotNull(CutOffAction.NAME, dispositionAction.getName());
assertNotNull(dispositionAction.getAsOfDate());
assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder));
}
});
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// check the search aspect properties
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
}
});
}
public void when() throws Exception {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// move record folder
fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate());
}
});
}
public void then() {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// check for the lifecycle aspect
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
// check the disposition action details
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder);
assertNotNull(dispositionAction);
assertNotNull(CutOffAction.NAME, dispositionAction.getName());
assertNotNull(dispositionAction.getAsOfDate());
assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder));
// check the search aspect properties
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
}
});
}
});
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class MoveRecordFolderTest method testMoveRecordFolderWithRecordsBeforeCutOffRecordLevelDisposition.
/**
*/
public void testMoveRecordFolderWithRecordsBeforeCutOffRecordLevelDisposition() throws Exception {
doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) {
NodeRef record;
NodeRef recordFolder;
NodeRef destinationRecordCategory;
public void given() {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
NodeRef rcOne = createRecordCategory(true);
destinationRecordCategory = createRecordCategory(true);
recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate());
record = utils.createRecord(recordFolder, GUID.generate());
// check for the lifecycle aspect
assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE));
// check the disposition action details
assertNull(dispositionService.getNextDispositionAction(recordFolder));
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record);
assertNotNull(dispositionAction);
assertNotNull(CutOffAction.NAME, dispositionAction.getName());
assertNotNull(dispositionAction.getAsOfDate());
assertTrue(dispositionService.isNextDispositionActionEligible(record));
}
});
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// check the search aspect properties
assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH));
assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME));
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF));
}
});
}
public void when() throws Exception {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// move record folder
fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate());
}
});
}
public void then() {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// check for the lifecycle aspect
assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE));
// check the disposition action details
assertNull(dispositionService.getNextDispositionAction(recordFolder));
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record);
assertNotNull(dispositionAction);
assertNotNull(CutOffAction.NAME, dispositionAction.getName());
assertNotNull(dispositionAction.getAsOfDate());
assertTrue(dispositionService.isNextDispositionActionEligible(record));
// check the search aspect properties
assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH));
assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME));
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF));
}
});
}
});
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class MoveRecordFolderTest method testMoveRecordFolderBeforeCutOffIntoAFolderWithNoDisposition.
/**
*/
public void testMoveRecordFolderBeforeCutOffIntoAFolderWithNoDisposition() throws Exception {
doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) {
NodeRef recordFolder;
NodeRef destinationRecordCategory;
public void given() {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
NodeRef rcOne = createRecordCategory(false);
destinationRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate());
// check for the lifecycle aspect
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
// check the disposition action details
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder);
assertNotNull(dispositionAction);
assertNotNull(CutOffAction.NAME, dispositionAction.getName());
assertNotNull(dispositionAction.getAsOfDate());
assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder));
}
});
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// check the search aspect properties
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
}
});
}
public void when() throws Exception {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// move record folder
fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate());
}
});
}
public void then() {
doTestInTransaction(new VoidTest() {
public void runImpl() throws Exception {
// check for the lifecycle aspect
assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
// check the disposition action details
assertNull(dispositionService.getNextDispositionAction(recordFolder));
// check the search aspect properties
assertFalse(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
}
});
}
});
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class EditDispositionActionAsOfDateAction method executeImpl.
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
* org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) {
// Get the action parameter
Date asOfDate = (Date) action.getParameterValue(PARAM_AS_OF_DATE);
if (asOfDate == null) {
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_VALID_DATE_DISP_ASOF));
}
// Set the dispostion action as of date
DispositionAction da = getDispositionService().getNextDispositionAction(actionedUponNodeRef);
if (da != null) {
getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate);
getNodeService().setProperty(da.getNodeRef(), PROP_MANUALLY_SET_AS_OF, true);
}
} else {
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DISP_ASOF_LIFECYCLE_APPLIED));
}
}
Aggregations