use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule in project records-management by Alfresco.
the class RecordsManagementSearchBehaviour method dispositionSchedulePropertiesUpdate.
/**
* Updates the disposition schedule properties
*
* @param nodeRef node reference
* @param before properties before
* @param after properties after
*/
public void dispositionSchedulePropertiesUpdate(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) {
if (nodeService.exists(nodeRef)) {
// create the schedule object and get the record category for it
DispositionSchedule schedule = new DispositionScheduleImpl(recordsManagementServiceRegistry, nodeService, nodeRef);
NodeRef recordCategoryNode = nodeService.getPrimaryParent(schedule.getNodeRef()).getParentRef();
if (schedule.isRecordLevelDisposition()) {
for (NodeRef recordFolder : getRecordFolders(recordCategoryNode)) {
for (NodeRef record : recordService.getRecords(recordFolder)) {
applySearchAspect(record);
setDispositionScheduleProperties(record, schedule);
}
}
} else {
for (NodeRef recordFolder : getRecordFolders(recordCategoryNode)) {
applySearchAspect(recordFolder);
setDispositionScheduleProperties(recordFolder, schedule);
}
}
}
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule in project records-management by Alfresco.
the class RecordsManagementSearchBehaviour method setupDispositionScheduleProperties.
/**
* Helper method to setup the disposition schedule properties
*
* @param recordOrFolder node reference of record or record folder
*/
private void setupDispositionScheduleProperties(NodeRef recordOrFolder) {
if (!methodCached("setupDispositionScheduleProperties", recordOrFolder)) {
DispositionSchedule ds = dispositionService.getDispositionSchedule(recordOrFolder);
if (ds == null) {
nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, false);
} else {
nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, true);
setDispositionScheduleProperties(recordOrFolder, ds);
}
if (logger.isDebugEnabled()) {
logger.debug("Set rma:recordSearchHasDispositionSchedule for node " + recordOrFolder + " to: " + (ds != null));
}
}
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule in project records-management by Alfresco.
the class MultipleSchedulesTest method setUpFilePlan.
/**
* Create two categories each containing a folder. Set up a schedule on category A that applies to records (cutoff
* immediately, destroy immediately). Set up a schedule on category B that is the same, but with a week delay before
* destroy becomes eligible.
*/
private void setUpFilePlan() {
// Only set up the file plan if it hasn't already been done.
if (categoryA != null) {
return;
}
// Create two categories.
categoryA = filePlanService.createRecordCategory(filePlan, CATEGORY_A_NAME);
categoryB = filePlanService.createRecordCategory(filePlan, CATEGORY_B_NAME);
categoryC = filePlanService.createRecordCategory(filePlan, CATEGORY_C_NAME);
// Create a disposition schedule for category A (Cut off immediately, then Destroy immediately).
DispositionSchedule dispSchedA = utils.createBasicDispositionSchedule(categoryA, "instructions", "authority", true, false);
Map<QName, Serializable> cutOffParamsA = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME, PROP_DISPOSITION_DESCRIPTION, "description", PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
dispositionService.addDispositionActionDefinition(dispSchedA, cutOffParamsA);
Map<QName, Serializable> destroyParamsA = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME, PROP_DISPOSITION_DESCRIPTION, "description", PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
dispositionService.addDispositionActionDefinition(dispSchedA, destroyParamsA);
// Create a disposition schedule for category B (Cut off immediately, then Destroy one week after cutoff).
DispositionSchedule dispSchedB = utils.createBasicDispositionSchedule(categoryB, "instructions", "authority", true, false);
Map<QName, Serializable> cutOffParamsB = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME, PROP_DISPOSITION_DESCRIPTION, "description", PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
dispositionService.addDispositionActionDefinition(dispSchedB, cutOffParamsB);
Map<QName, Serializable> destroyParamsB = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME, PROP_DISPOSITION_DESCRIPTION, "description", PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_WEEK, PROP_DISPOSITION_PERIOD_PROPERTY, PROP_CUT_OFF_DATE);
dispositionService.addDispositionActionDefinition(dispSchedB, destroyParamsB);
// Create a disposition schedule for category C (Cut off immediately, then Destroy one year after cutoff).
DispositionSchedule dispSchedC = utils.createBasicDispositionSchedule(categoryC, "instructions", "authority", true, false);
Map<QName, Serializable> cutOffParamsC = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME, PROP_DISPOSITION_DESCRIPTION, "description", PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
dispositionService.addDispositionActionDefinition(dispSchedC, cutOffParamsC);
Map<QName, Serializable> destroyParamsC = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME, PROP_DISPOSITION_DESCRIPTION, "description", PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_YEAR, PROP_DISPOSITION_PERIOD_PROPERTY, PROP_CUT_OFF_DATE);
dispositionService.addDispositionActionDefinition(dispSchedC, destroyParamsC);
// Create a folder within each category.
folderA = recordFolderService.createRecordFolder(categoryA, FOLDER_A_NAME);
folderB = recordFolderService.createRecordFolder(categoryB, FOLDER_B_NAME);
folderC = recordFolderService.createRecordFolder(categoryC, FOLDER_C_NAME);
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule in project records-management by Alfresco.
the class TransferReportGenerator method getDispositionAuthority.
/**
* Gets the disposition authority from the list of the transfer nodes
*
* @param transferNodes The transfer nodes
* @return Disposition authority
*/
private String getDispositionAuthority(List<TransferNode> transferNodes) {
// use RMService to get disposition authority
String dispositionAuthority = null;
if (transferNodes.size() > 0) {
// use the first transfer item to get to disposition schedule
NodeRef nodeRef = transferNodes.iterator().next().getNodeRef();
DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef);
if (ds != null) {
dispositionAuthority = ds.getDispositionAuthority();
}
}
return dispositionAuthority == null ? StringUtils.EMPTY : dispositionAuthority;
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule in project records-management by Alfresco.
the class DestroyAction method isGhostOnDestroySetForAction.
/**
* Return true if the ghost on destroy property is set against the
* definition for the passed action on the specified node
*
* @param action
* @param nodeRef
* @return
*/
private boolean isGhostOnDestroySetForAction(Action action, NodeRef nodeRef) {
boolean ghostOnDestroy = this.ghostingEnabled;
String actionDefinitionName = action.getActionDefinitionName();
if (!StringUtils.isEmpty(actionDefinitionName)) {
DispositionSchedule dispositionSchedule = this.getDispositionService().getDispositionSchedule(nodeRef);
if (dispositionSchedule != null) {
DispositionActionDefinition actionDefinition = dispositionSchedule.getDispositionActionDefinitionByName(actionDefinitionName);
if (actionDefinition != null) {
String ghostOnDestroyProperty = actionDefinition.getGhostOnDestroy();
if (ghostOnDestroyProperty != null) {
ghostOnDestroy = "ghost".equals(actionDefinition.getGhostOnDestroy());
}
}
}
}
return ghostOnDestroy;
}
Aggregations