Java Code Examples for org.alfresco.service.cmr.action.Action#getTrackStatus()

The following examples show how to use org.alfresco.service.cmr.action.Action#getTrackStatus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Get whether the action should be tracked by the {@link ActionTrackingService} or not.
 * 
 * @param action        the action, which may or may not have any say about the status tracking
 * @return              <tt>true</tt> if the status must be tracked, otherwise <tt>false</tt>
 */
private boolean getTrackStatus(Action action)
{
    Boolean trackStatusManual = action.getTrackStatus();
    if (trackStatusManual != null)
    {
        return trackStatusManual.booleanValue();
    }
    // The flag has not be changed for the specific action, so use the value from the
    // action definition.
    ActionDefinition actionDef = getActionDefinition(action.getActionDefinitionName());
    if (actionDef == null)
    {
        return false;       // default to 'false' if the definition has disappeared
    }
    else
    {
        return actionDef.getTrackStatus();
    }
}
 
Example 2
Source File: ActionImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionImpl(Action action, String actionDefinitionName)
{
    super(action.getId(), action.getParameterValues());
    this.actionDefinitionName = actionDefinitionName;
    this.actionConditions = action.getActionConditions();
    this.compensatingAction = action.getCompensatingAction();
    this.createdDate = action.getCreatedDate();
    this.creator = action.getCreator();
    this.description = action.getDescription();
    this.trackStatus = action.getTrackStatus();
    this.executeAsynchronously = action.getExecuteAsychronously();
    this.modifiedDate = action.getModifiedDate();
    this.modifier = action.getModifier();
    this.nodeRef = action.getNodeRef();
    this.title = action.getTitle();
    this.executionStartDate = action.getExecutionStartDate();
    this.executionEndDate = action.getExecutionEndDate();
    this.executionStatus = action.getExecutionStatus();
    this.executionFailureMessage = action.getExecutionFailureMessage();
    if (action instanceof ActionImpl)
    {
        ActionImpl actionImpl = (ActionImpl) action;
        this.executionInstance = actionImpl.getExecutionInstance();
        this.runAsUserName = actionImpl.getRunAsUser();
        this.tenantId = actionImpl.getTenantId();
        this.actionChain = actionImpl.actionChain;
    }
}
 
Example 3
Source File: ActionServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Save the action property values
 * 
 * @param actionNodeRef the action node reference
 * @param action the action
 */
private void saveActionProperties(NodeRef actionNodeRef, Action action)
{
    // Update the action property values
    Map<QName, Serializable> props = this.nodeService.getProperties(actionNodeRef);
    props.put(ActionModel.PROP_ACTION_TITLE, action.getTitle());
    props.put(ActionModel.PROP_ACTION_DESCRIPTION, action.getDescription());
    if (action.getTrackStatus() != null)
    {
        props.put(ActionModel.PROP_TRACK_STATUS, action.getTrackStatus());
    }
    props.put(ActionModel.PROP_EXECUTE_ASYNCHRONOUSLY, action.getExecuteAsychronously());
    
    props.put(ActionModel.PROP_EXECUTION_START_DATE, action.getExecutionStartDate());
    props.put(ActionModel.PROP_EXECUTION_END_DATE, action.getExecutionEndDate());
    props.put(ActionModel.PROP_EXECUTION_ACTION_STATUS, action.getExecutionStatus());
    props.put(ActionModel.PROP_EXECUTION_FAILURE_MESSAGE, action.getExecutionFailureMessage());
    
    this.nodeService.setProperties(actionNodeRef, props);

    // Update the compensating action (model should enforce the singularity
    // of this association)
    Action compensatingAction = action.getCompensatingAction();
    List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(actionNodeRef, RegexQNamePattern.MATCH_ALL,
                ActionModel.ASSOC_COMPENSATING_ACTION);
    if (assocs.size() == 0)
    {
        if (compensatingAction != null)
        {
            // Map<QName, Serializable> props2 = new HashMap<QName,
            // Serializable>(2);
            // props2.put(ActionModel.PROP_DEFINITION_NAME,
            // compensatingAction.getActionDefinitionName());
            // props2.put(ContentModel.PROP_NODE_UUID,
            // compensatingAction.getId());

            // NodeRef compensatingActionNodeRef =
            // this.nodeService.createNode(
            // / actionNodeRef,
            // ActionModel.ASSOC_COMPENSATING_ACTION,
            // ActionModel.ASSOC_COMPENSATING_ACTION,
            // ActionModel.TYPE_ACTION,
            // props2).getChildRef();

            // Create the compensating node reference
            NodeRef compensatingActionNodeRef = createActionNodeRef(compensatingAction, actionNodeRef,
                        ActionModel.ASSOC_COMPENSATING_ACTION, ActionModel.ASSOC_COMPENSATING_ACTION);
            saveActionImpl(compensatingActionNodeRef, compensatingAction);
        }
    }
    else
    {
        ChildAssociationRef assoc = assocs.get(0);
        if (compensatingAction == null)
        {
            this.nodeService.removeChild(actionNodeRef, assoc.getChildRef());
        }
        else
        {
            saveActionImpl(assoc.getChildRef(), compensatingAction);
        }
    }
}