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 File: CMSClient.java From oneops with 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 2
Source File: ScriptTaskActivityBehavior.java From activiti6-boot2 with 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 3
Source File: ThrowBpmnErrorDelegate.java From activiti6-boot2 with 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 4
Source File: LoanService.java From spring-boot-with-activiti-drools-example with 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 File: HandleErrorInfoForPaymentListener.java From activiti-in-action-codes with 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 6
Source File: ServiceTaskVariablesTest.java From activiti6-boot2 with 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 7
Source File: SetVariableJavaDelegate.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) throws Exception { execution.setVariable("testVar", new Random().nextInt(100)); }
Example 8
Source File: VariablesTest.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { String var = (String) execution.getVariable("testVar"); execution.setVariable("testVar", var.toUpperCase()); }
Example 9
Source File: BusinessKeyCheckJavaDelegate.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { execution.setVariable("businessKeySetOnExecution", execution.getProcessInstanceBusinessKey()); }
Example 10
Source File: ProcessEndExecutionListener.java From activiti-in-action-codes with 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 11
Source File: InitDelegate.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) { execution.setVariable(ActivitiProducer.PROCESS_ID_PROPERTY, execution.getProcessInstanceId()); }
Example 12
Source File: TransformationDataOutputAssociation.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void evaluate(DelegateExecution execution) { Object value = this.transformation.getValue(execution); execution.setVariable(this.getTarget(), value); }
Example 13
Source File: VariablesTest.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { String testVar = (String) execution.getVariable("testVar", false); execution.setVariable("testVar", testVar + "2"); }
Example 14
Source File: SimpleBean.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) { execution.setVariable("visited", true); }
Example 15
Source File: VariableUpdateDelegate.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { execution.setVariable("zzz", 123456789L); }
Example 16
Source File: CustomSetConditionsExecutionListener.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public void notify(DelegateExecution execution) { execution.setVariable(flowId + "_activiti_conditions", conditions); }
Example 17
Source File: ExampleExecutionListenerOne.java From activiti6-boot2 with 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 18
Source File: ExampleFieldInjectedExecutionListener.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void notify(DelegateExecution execution) { execution.setVariable("var", fixedValue.getValue(execution).toString() + dynamicValue.getValue(execution).toString()); }
Example 19
Source File: DummyServiceTask2.java From activiti6-boot2 with 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 20
Source File: TestSignalService.java From activiti6-boot2 with 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); }