Search in sources :

Example 16 with DispositionAction

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;
}
Also used : DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Example 17 with DispositionAction

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));
    }
}
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)

Example 18 with DispositionAction

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);
    }
}
Also used : DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Example 19 with DispositionAction

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);
            }
        }
    }
}
Also used : Date(java.util.Date) DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Example 20 with DispositionAction

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);
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) AlfrescoRuntimeException(org.alfresco.error.AlfrescoRuntimeException) DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Aggregations

DispositionAction (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)23 NodeRef (org.alfresco.service.cmr.repository.NodeRef)10 Date (java.util.Date)8 Serializable (java.io.Serializable)6 DispositionActionDefinition (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition)6 QName (org.alfresco.service.namespace.QName)6 HashMap (java.util.HashMap)5 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)4 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 DispositionSchedule (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule)2 EventCompletionDetails (org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails)2 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)2 Period (org.alfresco.service.cmr.repository.Period)2 Test (org.junit.Test)2 Capability (org.alfresco.module.org_alfresco_module_rm.capability.Capability)1 DispositionActionImpl (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionImpl)1 Behaviour (org.alfresco.repo.policy.annotation.Behaviour)1 AuthenticationUtil (org.alfresco.repo.security.authentication.AuthenticationUtil)1 Action (org.alfresco.service.cmr.action.Action)1