@Override protected void notifyInternal(DelegateExecution context) throws Exception { boolean isServiceUpdated = StepsUtil.getIsServiceUpdated(context); String serviceName = StepsUtil.getServiceToProcessName(context); if(serviceName == null) { throw new IllegalStateException("Not able to determine service update status."); } String exportedVariableName = Constants.VAR_IS_SERVICE_UPDATED_VAR_PREFIX + serviceName; RuntimeService runtimeService = Context.getProcessEngineConfiguration().getRuntimeService(); String superExecutionId = context.getParentId(); Execution superExecutionResult = runtimeService.createExecutionQuery().executionId(superExecutionId).singleResult(); superExecutionId = superExecutionResult.getSuperExecutionId(); runtimeService.setVariable(superExecutionId, exportedVariableName, isServiceUpdated); }
@Override protected void notifyInternal(DelegateExecution context) throws Exception { boolean isServiceUpdated = StepsUtil.getIsServiceUpdated(context); String serviceName = StepsUtil.getServiceToProcessName(context); if(serviceName == null) { throw new IllegalStateException("Not able to determine service update status."); } String exportedVariableName = Constants.VAR_IS_SERVICE_UPDATED_VAR_PREFIX + serviceName; RuntimeService runtimeService = Context.getProcessEngineConfiguration().getRuntimeService(); String superExecutionId = context.getParentId(); Execution superExecutionResult = runtimeService.createExecutionQuery().executionId(superExecutionId).singleResult(); superExecutionId = superExecutionResult.getSuperExecutionId(); runtimeService.setVariable(superExecutionId, exportedVariableName, isServiceUpdated); }
.executionId(executionId) .activityId(activity) .singleResult(); .processInstanceId(processInstanceId) .activityId(activity) .singleResult();
@Override public Void execute(CommandContext commandContext) { ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext); ExecutionEntity execution = (ExecutionEntity) processEngineConfiguration.getRuntimeService().createExecutionQuery().executionId(executionId).singleResult(); if (execution == null) { throw new FlowableException("No execution could be found for id " + executionId); } FlowElement flowElement = execution.getCurrentFlowElement(); if (!(flowElement instanceof CaseServiceTask)) { throw new FlowableException("No execution could be found with a case service task for id " + executionId); } CaseServiceTask caseServiceTask = (CaseServiceTask) flowElement; CaseTaskActivityBehavior caseTaskActivityBehavior = (CaseTaskActivityBehavior) caseServiceTask.getBehavior(); caseTaskActivityBehavior.triggerCaseTask(execution, variables); return null; } }
@Override public List<IOParameter> getOutputParametersOfCaseTask(String executionId) { ExecutionEntity execution = (ExecutionEntity) processEngineConfiguration.getRuntimeService().createExecutionQuery().executionId(executionId).singleResult(); if (execution == null) { throw new FlowableException("No execution could be found for id " + executionId); } FlowElement flowElement = execution.getCurrentFlowElement(); if (!(flowElement instanceof CaseServiceTask)) { throw new FlowableException("No execution could be found with a case service task for id " + executionId); } List<IOParameter> cmmnParameters = new ArrayList<>(); CaseServiceTask caseServiceTask = (CaseServiceTask) flowElement; List<org.flowable.bpmn.model.IOParameter> parameters = caseServiceTask.getOutParameters(); for (org.flowable.bpmn.model.IOParameter ioParameter : parameters) { IOParameter parameter = new IOParameter(); parameter.setSource(ioParameter.getSource()); parameter.setSourceExpression(ioParameter.getSourceExpression()); parameter.setTarget(ioParameter.getTarget()); parameter.setTargetExpression(ioParameter.getTargetExpression()); cmmnParameters.add(parameter); } return cmmnParameters; }