Java Code Examples for org.flowable.engine.impl.util.CommandContextUtil#getVariableService()
The following examples show how to use
org.flowable.engine.impl.util.CommandContextUtil#getVariableService() .
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: ExternalWorkerTaskCompleteJobHandler.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) { ExecutionEntity executionEntity = (ExecutionEntity) variableScope; VariableService variableService = CommandContextUtil.getVariableService(commandContext); List<VariableInstanceEntity> jobVariables = variableService.findVariableInstanceBySubScopeIdAndScopeType(executionEntity.getId(), ScopeTypes.BPMN_EXTERNAL_WORKER); for (VariableInstanceEntity jobVariable : jobVariables) { executionEntity.setVariable(jobVariable.getName(), jobVariable.getValue()); CountingEntityUtil.handleDeleteVariableInstanceEntityCount(jobVariable, false); variableService.deleteVariableInstance(jobVariable); } if (configuration != null && configuration.startsWith("error:")) { String errorCode; if (configuration.length() > 6) { errorCode = configuration.substring(6); } else { errorCode = null; } ErrorPropagation.propagateError(errorCode, executionEntity); } else { CommandContextUtil.getAgenda(commandContext).planTriggerExecutionOperation(executionEntity); } }
Example 2
Source File: ExternalWorkerJobCompleteCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override protected void runJobLogic(ExternalWorkerJobEntity externalWorkerJob, CommandContext commandContext) { JobServiceConfiguration jobServiceConfiguration = CommandContextUtil.getJobServiceConfiguration(commandContext); // We need to remove the job handler configuration externalWorkerJob.setJobHandlerConfiguration(null); if (variables != null && !variables.isEmpty()) { VariableService variableService = CommandContextUtil.getVariableService(commandContext); VariableTypes variableTypes = CommandContextUtil.getVariableServiceConfiguration(commandContext).getVariableTypes(); for (Map.Entry<String, Object> variableEntry : variables.entrySet()) { String varName = variableEntry.getKey(); Object varValue = variableEntry.getValue(); VariableType variableType = variableTypes.findVariableType(varValue); VariableInstanceEntity variableInstance = variableService.createVariableInstance(varName, variableType, varValue); variableInstance.setScopeId(externalWorkerJob.getProcessInstanceId()); variableInstance.setSubScopeId(externalWorkerJob.getExecutionId()); variableInstance.setScopeType(ScopeTypes.BPMN_EXTERNAL_WORKER); variableService.insertVariableInstance(variableInstance); CountingEntityUtil.handleInsertVariableInstanceEntityCount(variableInstance); } } moveExternalWorkerJobToExecutableJob(jobServiceConfiguration, externalWorkerJob, commandContext); }
Example 3
Source File: ExternalWorkerJobBpmnErrorCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override protected void runJobLogic(ExternalWorkerJobEntity externalWorkerJob, CommandContext commandContext) { JobServiceConfiguration jobServiceConfiguration = CommandContextUtil.getJobServiceConfiguration(commandContext); // We need to remove the job handler configuration String errorHandlerConfiguration; if (errorCode != null) { errorHandlerConfiguration = "error:" + errorCode; } else { errorHandlerConfiguration = "error:"; } externalWorkerJob.setJobHandlerConfiguration(errorHandlerConfiguration); if (variables != null && !variables.isEmpty()) { VariableService variableService = CommandContextUtil.getVariableService(commandContext); VariableTypes variableTypes = CommandContextUtil.getVariableServiceConfiguration(commandContext).getVariableTypes(); for (Map.Entry<String, Object> variableEntry : variables.entrySet()) { String varName = variableEntry.getKey(); Object varValue = variableEntry.getValue(); VariableType variableType = variableTypes.findVariableType(varValue); VariableInstanceEntity variableInstance = variableService.createVariableInstance(varName, variableType, varValue); variableInstance.setScopeId(externalWorkerJob.getProcessInstanceId()); variableInstance.setSubScopeId(externalWorkerJob.getExecutionId()); variableInstance.setScopeType(ScopeTypes.BPMN_EXTERNAL_WORKER); variableService.insertVariableInstance(variableInstance); CountingEntityUtil.handleInsertVariableInstanceEntityCount(variableInstance); } } moveExternalWorkerJobToExecutableJob(jobServiceConfiguration, externalWorkerJob, commandContext); }