Java Code Examples for org.activiti.engine.delegate.DelegateTask#setVariablesLocal()

The following examples show how to use org.activiti.engine.delegate.DelegateTask#setVariablesLocal() . 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: TaskCompleteListener.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void notify(DelegateTask task)
{
    // Check all mandatory properties are set. This is checked here instead of in
    // the completeTask() to allow taskListeners to set variable values before checking
    propertyConverter.checkMandatoryProperties(task);

    // Set properties for ended task
    Map<String, Object> endTaskVariables = new HashMap<String, Object>();

    // Set task status to completed
    String statusKey = qNameConverter.mapQNameToName(WorkflowModel.PROP_STATUS);
    endTaskVariables.put(statusKey, "Completed");
    
    // Add pooled actors to task-variables to be preserved in history (if any)
    addPooledActorsAsVariable(task, endTaskVariables);
    
    // Set variables locally on the task
    task.setVariablesLocal(endTaskVariables);
}
 
Example 2
Source File: ActivitiPropertyConverter.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setTaskProperties(DelegateTask task, Map<QName, Serializable> properties)
{
    if(properties==null || properties.isEmpty())
        return;
    TypeDefinition type = typeManager.getFullTaskDefinition(task);
    Map<String, Object> variablesToSet = handlerRegistry.handleVariablesToSet(properties, type, task, DelegateTask.class);
    if(variablesToSet.size() > 0)
    {
        task.setVariablesLocal(variablesToSet);
    }

}