use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class HasDispositionDateCapabilityCondition 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.getNextDispositionAction(nodeRef);
if (dispositionAction != null) {
if (dispositionAction.getAsOfDate() != null) {
result = true;
}
} else if (filePlanService.isFilePlanComponent(nodeRef) && nodeService.getProperty(nodeRef, PROP_DISPOSITION_AS_OF) != null) {
result = true;
}
return result;
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class RecordsManagementSearchBehaviour method updateDispositionActionProperties.
/**
* On update disposition action properties behaviour implementation
*
* @param record record node reference
* @param dispositionAction disposition action
*/
private void updateDispositionActionProperties(NodeRef record, NodeRef dispositionAction) {
Map<QName, Serializable> props = nodeService.getProperties(record);
DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction);
props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName());
props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate());
props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE));
DispositionActionDefinition daDefinition = da.getDispositionActionDefinition();
if (daDefinition != null) {
Period period = daDefinition.getPeriod();
if (period != null) {
props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType());
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression());
} else {
props.put(PROP_RS_DISPOSITION_PERIOD, null);
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null);
}
}
nodeService.setProperties(record, props);
if (logger.isDebugEnabled()) {
logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_ACTION_NAME));
logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_ACTION_AS_OF));
logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_PERIOD));
logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
}
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class RecordsManagementSearchBehaviour method fixupSearchAspect.
/**
* Ensures the search aspect for the given node is present, complete and correct.
*
* @param recordOrFolder node reference to record or record folder
*/
public void fixupSearchAspect(NodeRef recordOrFolder) {
// for now only deal with record folders
if (recordFolderService.isRecordFolder(recordOrFolder)) {
// ensure the search aspect is applied
applySearchAspect(recordOrFolder);
// setup the properties relating to the disposition schedule
setupDispositionScheduleProperties(recordOrFolder);
// setup the properties relating to the disposition lifecycle
DispositionAction da = dispositionService.getNextDispositionAction(recordOrFolder);
if (da != null) {
updateDispositionActionProperties(recordOrFolder, da.getNodeRef());
setupDispositionActionEvents(recordOrFolder, da);
}
// setup the properties relating to the vital record indicator
setVitalRecordDefintionDetails(recordOrFolder);
}
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class CompleteEventAction 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 (getNodeService().exists(actionedUponNodeRef) && !getFreezeService().isFrozen(actionedUponNodeRef)) {
/**
* get parameter values
*/
String eventName = (String) action.getParameterValue(PARAM_EVENT_NAME);
String eventCompletedBy = (String) action.getParameterValue(PARAM_EVENT_COMPLETED_BY);
Date eventCompletedAt = (Date) action.getParameterValue(PARAM_EVENT_COMPLETED_AT);
if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) {
// Get the next disposition action
DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef);
if (da != null) {
// complete event
da.completeEvent(eventName, eventCompletedAt, eventCompletedBy);
}
}
}
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.
the class UnCutoffAction 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 (getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) && getNodeService().hasAspect(actionedUponNodeRef, ASPECT_CUT_OFF)) {
// Get the last disposition action
DispositionAction da = getDispositionService().getLastCompletedDispostionAction(actionedUponNodeRef);
// Check that the last disposition action was a cutoff
if (da == null || !da.getName().equals("cutoff")) {
// Can not undo cut off since cut off was not the last thing done
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDO_NOT_LAST));
}
// Remove the cutoff aspect and add the uncutoff aspect
getNodeService().removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF);
getNodeService().addAspect(actionedUponNodeRef, ASPECT_UNCUT_OFF, null);
if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) {
List<NodeRef> records = getRecordService().getRecords(actionedUponNodeRef);
for (NodeRef record : records) {
getNodeService().removeAspect(record, ASPECT_CUT_OFF);
getNodeService().addAspect(record, ASPECT_UNCUT_OFF, null);
}
}
// Delete the current disposition action
DispositionAction currentDa = getDispositionService().getNextDispositionAction(actionedUponNodeRef);
if (currentDa != null) {
getNodeService().deleteNode(currentDa.getNodeRef());
}
// Move the previous (cutoff) disposition back to be current
getNodeService().moveNode(da.getNodeRef(), actionedUponNodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION);
// Reset the started and completed property values
getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_AT, null);
getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_BY, null);
getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, null);
getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, null);
}
}
Aggregations