Search in sources :

Example 6 with EventCompletionDetails

use of org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails in project records-management by Alfresco.

the class DispositionActionImpl method getEventCompletionDetails.

/**
 * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getEventCompletionDetails()
 */
public List<EventCompletionDetails> getEventCompletionDetails() {
    List<ChildAssociationRef> assocs = services.getNodeService().getChildAssocs(this.dispositionNodeRef, ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
    List<EventCompletionDetails> result = new ArrayList<EventCompletionDetails>(assocs.size());
    for (ChildAssociationRef assoc : assocs) {
        result.add(getEventCompletionDetailsFromNodeRef(assoc.getChildRef()));
    }
    return result;
}
Also used : EventCompletionDetails(org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails) ArrayList(java.util.ArrayList) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Example 7 with EventCompletionDetails

use of org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails in project records-management by Alfresco.

the class DispositionActionImpl method getEventCompletionDetails.

/**
 * Gets the event completion details for the named event.
 * <p>
 * Returns null if event can not be found.
 *
 * @param  eventName   name of the event
 * @return {@link EventCompletionDetails}   event completion details for named event, null otherwise
 *
 * @since 2.2
 */
@Override
public EventCompletionDetails getEventCompletionDetails(String eventName) {
    EventCompletionDetails result = null;
    List<ChildAssociationRef> assocs = services.getNodeService().getChildAssocsByPropertyValue(dispositionNodeRef, PROP_EVENT_EXECUTION_NAME, eventName);
    if (!assocs.isEmpty()) {
        if (assocs.size() != 1) {
            throw new AlfrescoRuntimeException("Unable to get event completion details, because more than one child was found for event " + eventName);
        }
        result = getEventCompletionDetailsFromNodeRef(assocs.get(0).getChildRef());
    }
    return result;
}
Also used : EventCompletionDetails(org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails) AlfrescoRuntimeException(org.alfresco.error.AlfrescoRuntimeException) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Example 8 with EventCompletionDetails

use of org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails in project records-management by Alfresco.

the class RecordsManagementSearchBehaviour method setupDispositionActionEvents.

/**
 * Helper method to setup disposition action events.
 *
 * @param nodeRef   node reference
 * @param da        disposition action
 */
private void setupDispositionActionEvents(NodeRef nodeRef, DispositionAction da) {
    if (!methodCached("setupDispositionActionEvents", nodeRef)) {
        if (da != null) {
            List<String> eventNames = null;
            List<EventCompletionDetails> eventsList = da.getEventCompletionDetails();
            if (eventsList.size() > 0) {
                eventNames = new ArrayList<String>(eventsList.size());
                for (EventCompletionDetails event : eventsList) {
                    eventNames.add(event.getEventName());
                }
            }
            // set the property
            nodeService.setProperty(nodeRef, PROP_RS_DISPOSITION_EVENTS, (Serializable) eventNames);
            if (logger.isDebugEnabled()) {
                logger.debug("Set rma:recordSearchDispositionEvents for node " + nodeRef + " to: " + eventNames);
            }
        }
    }
}
Also used : EventCompletionDetails(org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails)

Aggregations

EventCompletionDetails (org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails)8 ArrayList (java.util.ArrayList)4 Serializable (java.io.Serializable)2 DispositionAction (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)2 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)2 QName (org.alfresco.service.namespace.QName)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)1 DispositionActionDefinition (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 Period (org.alfresco.service.cmr.repository.Period)1