use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition in project records-management by Alfresco.
the class MayBeScheduledCapabilityCondition 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;
DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef);
if (dispositionSchedule != null && checkDispositionLevel(nodeRef, dispositionSchedule)) {
for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions()) {
if (dispositionActionDefinition.getName().equals(dispositionAction)) {
result = true;
break;
}
}
}
return result;
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition in project records-management by Alfresco.
the class DispositionActionDefinitionDelete method removeDispositionActionDefinitions.
/**
* Helper method to remove a disposition action definition and the following definition(s)
*
* @param schedule The disposition schedule
* @param actionDef The disposition action definition
*/
private void removeDispositionActionDefinitions(DispositionSchedule schedule, DispositionActionDefinition actionDef) {
int index = actionDef.getIndex();
List<DispositionActionDefinition> dispositionActionDefinitions = schedule.getDispositionActionDefinitions();
for (DispositionActionDefinition dispositionActionDefinition : dispositionActionDefinitions) {
if (dispositionActionDefinition.getIndex() >= index) {
getDispositionService().removeDispositionActionDefinition(schedule, dispositionActionDefinition);
}
}
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition in project records-management by Alfresco.
the class DispositionActionDefinitionPut method executeImpl.
/*
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
// parse the request to retrieve the schedule object
DispositionSchedule schedule = parseRequestForSchedule(req);
// parse the request to retrieve the action definition object
DispositionActionDefinition actionDef = parseRequestForActionDefinition(req, schedule);
// retrieve the rest of the post body and update the action definition
JSONObject json = null;
try {
json = new JSONObject(new JSONTokener(req.getContent().getContent()));
actionDef = updateActionDefinition(actionDef, json);
} catch (IOException iox) {
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not read content from req.", iox);
} catch (JSONException je) {
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", je);
}
// create model object with just the action data
Map<String, Object> model = new HashMap<String, Object>(1);
model.put("action", createActionDefModel(actionDef, req.getURL()));
return model;
}
use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition 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.DispositionActionDefinition 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