Search in sources :

Example 1 with DispositionActionImpl

use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionImpl 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));
    }
}
Also used : Serializable(java.io.Serializable) QName(org.alfresco.service.namespace.QName) Period(org.alfresco.service.cmr.repository.Period) DispositionActionDefinition(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition) DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction) DispositionActionImpl(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionImpl)

Aggregations

Serializable (java.io.Serializable)1 DispositionAction (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)1 DispositionActionDefinition (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition)1 DispositionActionImpl (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionImpl)1 Period (org.alfresco.service.cmr.repository.Period)1 QName (org.alfresco.service.namespace.QName)1