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

The following examples show how to use org.activiti.engine.delegate.DelegateTask#setVariableLocal() . 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: TaskCreateListener.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void notify(DelegateTask task)
{
    // Set all default properties, based on the type-definition
    propertyConverter.setDefaultTaskProperties(task);

    String taskFormKey = getFormKey(task);
    
    // Fetch definition and extract name again. Possible that the default is used if the provided is missing
    TypeDefinition typeDefinition = propertyConverter.getWorkflowObjectFactory().getTaskTypeDefinition(taskFormKey, false);
    taskFormKey = typeDefinition.getName().toPrefixString();
    
    // The taskDefinition key is set as a variable in order to be available
    // in the history
    task.setVariableLocal(ActivitiConstants.PROP_TASK_FORM_KEY, taskFormKey);
    
    // Add process initiator as involved person
    ActivitiScriptNode initiatorNode = (ActivitiScriptNode) task.getExecution().getVariable(WorkflowConstants.PROP_INITIATOR);
    if(initiatorNode != null) {
        task.addUserIdentityLink((String) initiatorNode.getProperties().get(ContentModel.PROP_USERNAME.toPrefixString()), IdentityLinkType.STARTER);
    }
}
 
Example 2
Source File: SetRandomVariablesTaskListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
  String varName;
  for (int i = 0; i < 5; i++) {
    varName = "variable-" + new Random().nextInt(10);
    delegateTask.getExecution().setVariable(varName, getRandomValue());
  }

  for (int i = 0; i < 5; i++) {
    varName = "task-variable-" + new Random().nextInt(10);
    delegateTask.setVariableLocal(varName, getRandomValue());
  }
}
 
Example 3
Source File: SetRandomVariablesTaskListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
  String varName;
  for(int i=0; i<5; i++) {
    varName = "variable-" + new Random().nextInt(10);
    delegateTask.getExecution().setVariable(varName, getRandomValue());
  }
  
  for(int i=0; i<5; i++) {
    varName = "task-variable-" + new Random().nextInt(10);
    delegateTask.setVariableLocal(varName, getRandomValue());
  }
}
 
Example 4
Source File: TaskCompleteListener.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  delegateTask.getExecution().setVariable("greeting", "Hello from " + greeter.getValue(delegateTask.getExecution()));
  delegateTask.getExecution().setVariable("shortName", shortName.getValue(delegateTask.getExecution()));

  delegateTask.setVariableLocal("myTaskVariable", "test");
}
 
Example 5
Source File: VariableEventsTaskListener.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
  delegateTask.setVariableLocal("variable", 123);
  delegateTask.setVariableLocal("variable", 456);
  delegateTask.removeVariableLocal("variable");
}
 
Example 6
Source File: TaskCompleteListener.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  delegateTask.getExecution().setVariable("greeting", "Hello from " + greeter.getValue(delegateTask.getExecution()));
  delegateTask.getExecution().setVariable("shortName", shortName.getValue(delegateTask.getExecution()));
  
  delegateTask.setVariableLocal("myTaskVariable", "test");
}
 
Example 7
Source File: VariableEventsTaskListener.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
delegateTask.setVariableLocal("variable", 123);
delegateTask.setVariableLocal("variable", 456);
delegateTask.removeVariableLocal("variable");
}