Java Code Examples for org.activiti.engine.delegate.DelegateExecution#setVariable()
The following examples show how to use
org.activiti.engine.delegate.DelegateExecution#setVariable() .
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 Project: activiti6-boot2 File: ThrowBpmnErrorDelegate.java License: Apache License 2.0 | 5 votes |
public void execute(DelegateExecution execution) { Integer executionsBeforeError = (Integer) execution.getVariable("executionsBeforeError"); Integer executions = (Integer) execution.getVariable("executions"); if (executions == null) { executions = 0; } executions++; if (executionsBeforeError == null || executionsBeforeError < executions) { throw new BpmnError("23", "This is a business fault, which can be caught by a BPMN Error Event."); } else { execution.setVariable("executions", executions); } }
Example 2
Source Project: activiti-in-action-codes File: HandleErrorInfoForPaymentListener.java License: Apache License 2.0 | 5 votes |
@Override public void notify(DelegateExecution execution) throws Exception { String currentActivityId = execution.getCurrentActivityId(); if ("exclusivegateway-treasurerAudit".equals(currentActivityId)) { execution.setVariable("message", "财务审批未通过"); } else if ("exclusivegateway-generalManagerAudit".equals(currentActivityId)) { execution.setVariable("message", "总经理审批未通过"); } }
Example 3
Source Project: activiti6-boot2 File: ServiceTaskVariablesTest.java License: Apache License 2.0 | 5 votes |
public void execute(DelegateExecution execution) { Variable v = (Variable) execution.getVariable("variable"); synchronized (ServiceTaskVariablesTest.class) { // we expect this to be 'true' isOkInDelegate2 = (v.value != null && v.value.equals("delegate1")); } v.value = "delegate2"; execution.setVariable("variable", v); }
Example 4
Source Project: spring-boot-with-activiti-drools-example File: LoanService.java License: MIT License | 5 votes |
@Override public void execute(DelegateExecution arg0) throws Exception { // TODO Auto-generated method stub LoanApplicant loan = new LoanApplicant(); loan.setName((String) arg0.getVariable("name")); loan.setLoanAmount((Long) arg0.getVariable("amount")); loan.setIncome((Long) arg0.getVariable("salary")); arg0.setVariable("loanapplicant", loan); }
Example 5
Source Project: activiti6-boot2 File: ScriptTaskActivityBehavior.java License: Apache License 2.0 | 5 votes |
public void execute(DelegateExecution execution) { ActivityExecution activityExecution = (ActivityExecution) execution; ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) { ObjectNode taskElementProperties = Context.getBpmnOverrideElementProperties(scriptTaskId, execution.getProcessDefinitionId()); if (taskElementProperties != null && taskElementProperties.has(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT)) { String overrideScript = taskElementProperties.get(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT).asText(); if (StringUtils.isNotEmpty(overrideScript) && overrideScript.equals(script) == false) { script = overrideScript; } } } boolean noErrors = true; try { Object result = scriptingEngines.evaluate(script, language, execution, storeScriptVariables); if (resultVariable != null) { execution.setVariable(resultVariable, result); } } catch (ActivitiException e) { LOGGER.warn("Exception while executing " + activityExecution.getActivity().getId() + " : " + e.getMessage()); noErrors = false; Throwable rootCause = ExceptionUtils.getRootCause(e); if (rootCause instanceof BpmnError) { ErrorPropagation.propagateError((BpmnError) rootCause, activityExecution); } else { throw e; } } if (noErrors) { leave(activityExecution); } }
Example 6
Source Project: oneops File: CMSClient.java License: Apache License 2.0 | 5 votes |
private void handleGetWoError(DelegateExecution exec, CmsDeployment dpmt, CmsWorkOrderSimple dpmtRec, String descr) { dpmt.setDeploymentState(FAILED); dpmt.setDescription(descr); exec.setVariable(DPMT, dpmt); setOrCreateLocalVar(exec, WorkflowController.WO_STATE, WorkflowController.WO_FAILED); setOrCreateLocalVar(exec, "wo", dpmtRec); }
Example 7
Source Project: activiti6-boot2 File: VariablesTest.java License: Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { String testVar = (String) execution.getVariable("testVar", false); execution.setVariable("testVar", testVar + "2"); }
Example 8
Source Project: activiti6-boot2 File: DummyServiceTask2.java License: Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { Integer count = (Integer) execution.getVariable("count2"); count = count+1; execution.setVariable("count2", count); }
Example 9
Source Project: activiti6-boot2 File: ExampleFieldInjectedExecutionListener.java License: Apache License 2.0 | 4 votes |
public void notify(DelegateExecution execution) { execution.setVariable("var", fixedValue.getValue(execution).toString() + dynamicValue.getValue(execution).toString()); }
Example 10
Source Project: activiti6-boot2 File: ExampleExecutionListenerOne.java License: Apache License 2.0 | 4 votes |
public void notify(DelegateExecution execution) { execution.setVariable("variableSetInExecutionListener", "firstValue"); execution.setVariable("eventNameReceived", execution.getEventName()); execution.setVariable("businessKeyInExecution", execution.getProcessInstanceBusinessKey()); }
Example 11
Source Project: activiti6-boot2 File: CustomSetConditionsExecutionListener.java License: Apache License 2.0 | 4 votes |
@Override public void notify(DelegateExecution execution) { execution.setVariable(flowId + "_activiti_conditions", conditions); }
Example 12
Source Project: activiti6-boot2 File: VariableUpdateDelegate.java License: Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { execution.setVariable("zzz", 123456789L); }
Example 13
Source Project: activiti6-boot2 File: SimpleBean.java License: Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) { execution.setVariable("visited", true); }
Example 14
Source Project: activiti6-boot2 File: SetVariableJavaDelegate.java License: Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) throws Exception { execution.setVariable("testVar", new Random().nextInt(100)); }
Example 15
Source Project: activiti6-boot2 File: TransformationDataOutputAssociation.java License: Apache License 2.0 | 4 votes |
public void evaluate(DelegateExecution execution) { Object value = this.transformation.getValue(execution); execution.setVariable(this.getTarget(), value); }
Example 16
Source Project: activiti6-boot2 File: InitDelegate.java License: Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) { execution.setVariable(ActivitiProducer.PROCESS_ID_PROPERTY, execution.getProcessInstanceId()); }
Example 17
Source Project: activiti-in-action-codes File: ProcessEndExecutionListener.java License: Apache License 2.0 | 4 votes |
@Override public void notify(DelegateExecution execution) throws Exception { execution.setVariable("setInEndListener", true); System.out.println(this.getClass().getSimpleName() + ", " + execution.getEventName()); }
Example 18
Source Project: activiti6-boot2 File: BusinessKeyCheckJavaDelegate.java License: Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { execution.setVariable("businessKeySetOnExecution", execution.getProcessInstanceBusinessKey()); }
Example 19
Source Project: activiti6-boot2 File: VariablesTest.java License: Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { String var = (String) execution.getVariable("testVar"); execution.setVariable("testVar", var.toUpperCase()); }
Example 20
Source Project: activiti6-boot2 File: TestSignalService.java License: Apache License 2.0 | 2 votes |
/** * Dummy service that uses a mock to simulate a file system. * * Normally, a database (or file system) is checked, if a file is present or * not. */ public void execute(DelegateExecution execution) { // save current state into the process variable boolean exists = FileExistsMock.getInstance().fileExists(); execution.setVariable("fileexists", exists); }