Java Code Examples for org.flowable.engine.delegate.DelegateExecution#getVariables()

The following examples show how to use org.flowable.engine.delegate.DelegateExecution#getVariables() . 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: CamelBehavior.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected Exchange createExchange(DelegateExecution activityExecution, FlowableEndpoint endpoint) {
    Exchange ex = endpoint.createExchange();
    ex.setProperty(FlowableProducer.PROCESS_ID_PROPERTY, activityExecution.getProcessInstanceId());
    ex.setProperty(FlowableProducer.EXECUTION_ID_PROPERTY, activityExecution.getId());
    Map<String, Object> variables = activityExecution.getVariables();
    updateTargetVariables(endpoint);
    copyVariables(variables, ex, endpoint);
    return ex;
}
 
Example 2
Source File: TransientVariablesTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public void execute(DelegateExecution execution) {
    Map<String, Object> vars = execution.getVariables();
    List<String> varNames = new ArrayList<String>(vars.keySet());
    Collections.sort(varNames);

    StringBuilder strb = new StringBuilder();
    for (String varName : varNames) {
        strb.append(vars.get(varName));
    }

    execution.setVariable("result", strb.toString());
}
 
Example 3
Source File: VariablesTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public void execute(DelegateExecution execution) {
    Map<String, Object> vars = execution.getVariables(Arrays.asList("testVar1", "testVar2", "testVar3"), false);

    String testVar1 = (String) vars.get("testVar1");
    String testVar2 = (String) vars.get("testVar2");
    String testVar3 = (String) vars.get("testVar3");

    execution.setVariable("testVar1", testVar1 + "-CHANGED", false);
    execution.setVariable("testVar2", testVar2 + "-CHANGED", false);
    execution.setVariable("testVar3", testVar3 + "-CHANGED", false);

    execution.setVariableLocal("localVar", "localValue", false);
}
 
Example 4
Source File: ListenerNotificationHelper.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void planTransactionDependentExecutionListener(ListenerFactory listenerFactory, DelegateExecution execution, 
                TransactionDependentExecutionListener executionListener, FlowableListener listener) {
    
    Map<String, Object> executionVariablesToUse = execution.getVariables();
    CustomPropertiesResolver customPropertiesResolver = createCustomPropertiesResolver(listener);
    Map<String, Object> customPropertiesMapToUse = invokeCustomPropertiesResolver(execution, customPropertiesResolver);

    TransactionDependentExecutionListenerExecutionScope scope = new TransactionDependentExecutionListenerExecutionScope(
            execution.getProcessInstanceId(), execution.getId(), execution.getCurrentFlowElement(), executionVariablesToUse, customPropertiesMapToUse);

    addTransactionListener(listener, new ExecuteExecutionListenerTransactionListener(executionListener, scope, 
                    CommandContextUtil.getProcessEngineConfiguration().getCommandExecutor()));
}
 
Example 5
Source File: ListenerNotificationHelper.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void planTransactionDependentTaskListener(DelegateExecution execution, TransactionDependentTaskListener taskListener, FlowableListener listener) {
    Map<String, Object> executionVariablesToUse = execution.getVariables();
    CustomPropertiesResolver customPropertiesResolver = createCustomPropertiesResolver(listener);
    Map<String, Object> customPropertiesMapToUse = invokeCustomPropertiesResolver(execution, customPropertiesResolver);

    TransactionDependentTaskListenerExecutionScope scope = new TransactionDependentTaskListenerExecutionScope(
            execution.getProcessInstanceId(), execution.getId(), (Task) execution.getCurrentFlowElement(), executionVariablesToUse, customPropertiesMapToUse);
    addTransactionListener(listener, new ExecuteTaskListenerTransactionListener(taskListener, scope,
                    CommandContextUtil.getProcessEngineConfiguration().getCommandExecutor()));
}
 
Example 6
Source File: TransientVariablesTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {
    Map<String, Object> vars = execution.getVariables();
    List<String> varNames = new ArrayList<>(vars.keySet());
    Collections.sort(varNames);

    StringBuilder strb = new StringBuilder();
    for (String varName : varNames) {
        strb.append(vars.get(varName));
    }

    execution.setVariable("result", strb.toString());
}
 
Example 7
Source File: VariablesTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {
    Map<String, Object> vars = execution.getVariables(Arrays.asList("testVar1", "testVar2", "testVar3"), false);

    String testVar1 = (String) vars.get("testVar1");
    String testVar2 = (String) vars.get("testVar2");
    String testVar3 = (String) vars.get("testVar3");

    execution.setVariable("testVar1", testVar1 + "-CHANGED", false);
    execution.setVariable("testVar2", testVar2 + "-CHANGED", false);
    execution.setVariable("testVar3", testVar3 + "-CHANGED", false);

    execution.setVariableLocal("localVar", "localValue", false);
}