Java Code Examples for org.activiti.engine.delegate.DelegateExecution#setVariables()
The following examples show how to use
org.activiti.engine.delegate.DelegateExecution#setVariables() .
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 activiti6-boot2 with Apache License 2.0 | 5 votes |
public void execute(DelegateExecution execution) { setAppropriateCamelContext(execution); final ActivitiEndpoint endpoint = createEndpoint(execution); final Exchange exchange = createExchange(execution, endpoint); try { endpoint.process(exchange); } catch (Exception e) { throw new ActivitiException("Exception while processing exchange", e); } execution.setVariables(ExchangeUtils.prepareVariables(exchange, endpoint)); boolean isActiviti5Execution = false; if ((Context.getCommandContext() != null && Activiti5Util.isActiviti5ProcessDefinitionId(Context.getCommandContext(), execution.getProcessDefinitionId())) || (Context.getCommandContext() == null && Activiti5Util.getActiviti5CompatibilityHandler() != null)) { isActiviti5Execution = true; } if (!handleCamelException(exchange, execution, isActiviti5Execution)) { if (isActiviti5Execution) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = Activiti5Util.getActiviti5CompatibilityHandler(); activiti5CompatibilityHandler.leaveExecution(execution); return; } leave(execution); } }
Example 2
Source File: DmnActivityBehavior.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { FieldExtension fieldExtension = DelegateHelper.getFlowElementField(execution, EXPRESSION_DECISION_TABLE_REFERENCE_KEY); if (fieldExtension == null || ((fieldExtension.getStringValue() == null || fieldExtension.getStringValue().length() == 0) && (fieldExtension.getExpression() == null || fieldExtension.getExpression().length() == 0))) { throw new ActivitiException("decisionTableReferenceKey is a required field extension for the dmn task " + task.getId()); } String activeDecisionTableKey = null; if (fieldExtension.getExpression() != null && fieldExtension.getExpression().length() > 0) { activeDecisionTableKey = fieldExtension.getExpression(); } else { activeDecisionTableKey = fieldExtension.getStringValue(); } ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); ExpressionManager expressionManager = processEngineConfiguration.getExpressionManager(); if (processEngineConfiguration.isEnableProcessDefinitionInfoCache()) { ObjectNode taskElementProperties = Context.getBpmnOverrideElementProperties(task.getId(), execution.getProcessDefinitionId()); activeDecisionTableKey = getActiveValue(activeDecisionTableKey, DynamicBpmnConstants.DMN_TASK_DECISION_TABLE_KEY, taskElementProperties); } String finaldecisionTableKeyValue = null; Object decisionTableKeyValue = expressionManager.createExpression(activeDecisionTableKey).getValue(execution); if (decisionTableKeyValue != null) { if (decisionTableKeyValue instanceof String) { finaldecisionTableKeyValue = (String) decisionTableKeyValue; } else { throw new ActivitiIllegalArgumentException("decisionTableReferenceKey expression does not resolve to a string: " + decisionTableKeyValue); } } if (finaldecisionTableKeyValue == null || finaldecisionTableKeyValue.length() == 0) { throw new ActivitiIllegalArgumentException("decisionTableReferenceKey expression resolves to an empty value: " + decisionTableKeyValue); } ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(execution.getProcessDefinitionId()); DmnRuleService ruleService = processEngineConfiguration.getDmnEngineRuleService(); RuleEngineExecutionResult executionResult = ruleService.executeDecisionByKeyParentDeploymentIdAndTenantId(finaldecisionTableKeyValue, processDefinition.getDeploymentId(), execution.getVariables(), execution.getTenantId()); execution.setVariables(executionResult.getResultVariables()); leave(execution); }