/** * Returns the current {@link FlowElement} where the {@link DelegateExecution} is currently at. */ public static FlowElement getFlowElement(DelegateExecution execution) { BpmnModel bpmnModel = getBpmnModel(execution); FlowElement flowElement = bpmnModel.getFlowElement(execution.getCurrentActivityId()); if (flowElement == null) { throw new ActivitiException("Could not find a FlowElement for activityId " + execution.getCurrentActivityId()); } return flowElement; }
protected void terminateAllBehaviour(DelegateExecution execution, CommandContext commandContext, ExecutionEntityManager executionEntityManager) { ExecutionEntity rootExecutionEntity = executionEntityManager.findByRootProcessInstanceId(execution.getRootProcessInstanceId()); String deleteReason = createDeleteReason(execution.getCurrentActivityId()); deleteExecutionEntities(executionEntityManager, rootExecutionEntity, deleteReason); endAllHistoricActivities(rootExecutionEntity.getId(), deleteReason); commandContext.getHistoryManager().recordProcessInstanceEnd(rootExecutionEntity.getId(), deleteReason, execution.getCurrentActivityId()); }
public void execute(DelegateExecution execution) { JobManager jobManager = Context.getCommandContext().getJobManager(); // end date should be ignored for intermediate timer events. TimerJobEntity timerJob = jobManager.createTimerJob(timerEventDefinition, false, (ExecutionEntity) execution, TriggerTimerEventJobHandler.TYPE, TimerEventHandler.createConfiguration(execution.getCurrentActivityId(), null, timerEventDefinition.getCalendarName())); if (timerJob != null) { jobManager.scheduleTimerJob(timerJob); } }
Collection<ExecutionEntity> joinedExecutions = executionEntityManager.findInactiveExecutionsByActivityIdAndProcessInstanceId(execution.getCurrentActivityId(), execution.getProcessInstanceId()); if (multiInstanceExecution != null) { joinedExecutions = cleanJoinedExecutions(joinedExecutions, multiInstanceExecution); log.debug("parallel gateway '{}' activates: {} of {} joined", execution.getCurrentActivityId(), nbrOfExecutionsCurrentlyJoined, nbrOfExecutionsToJoin); log.debug("parallel gateway '{}' does not activate: {} of {} joined", execution.getCurrentActivityId(), nbrOfExecutionsCurrentlyJoined, nbrOfExecutionsToJoin);
@Override public void execute(DelegateExecution execution) { ExecutionEntity executionEntity = (ExecutionEntity) execution; if (!(execution.getCurrentFlowElement() instanceof BoundaryEvent)) { throw new ActivitiException("Programmatic error: " + this.getClass() + " should not be used for anything else than a boundary event"); } JobManager jobManager = Context.getCommandContext().getJobManager(); TimerJobEntity timerJob = jobManager.createTimerJob(timerEventDefinition, interrupting, executionEntity, TriggerTimerEventJobHandler.TYPE, TimerEventHandler.createConfiguration(execution.getCurrentActivityId(), timerEventDefinition.getEndDate(), timerEventDefinition.getCalendarName())); if (timerJob != null) { jobManager.scheduleTimerJob(timerJob); } }
for (SequenceFlow outgoingSequenceFlow : outgoingSequenceFlows) { if (outgoingSequenceFlow.getTargetFlowElement() != null && !outgoingSequenceFlow.getTargetFlowElement().getId().equals(execution.getCurrentActivityId())) { eventActivityIds.add(outgoingSequenceFlow.getTargetFlowElement().getId());
log.debug("Leaving exclusive gateway '{}'", execution.getCurrentActivityId());
private IntegrationContextImpl buildFromExecution(DelegateExecution execution, ActionDefinition actionDefinition) { IntegrationContextImpl integrationContext = new IntegrationContextImpl(); integrationContext.setProcessInstanceId(execution.getProcessInstanceId()); integrationContext.setProcessDefinitionId(execution.getProcessDefinitionId()); integrationContext.setActivityElementId(execution.getCurrentActivityId()); integrationContext.setBusinessKey(execution.getProcessInstanceBusinessKey()); if(ExecutionEntity.class.isInstance(execution)) { ExecutionEntity processInstance = ExecutionEntity.class.cast(execution) .getProcessInstance(); if(processInstance != null) { integrationContext.setProcessDefinitionKey(processInstance.getProcessDefinitionKey()); integrationContext.setProcessDefinitionVersion(processInstance.getProcessDefinitionVersion()); integrationContext.setParentProcessInstanceId(processInstance.getParentProcessInstanceId()); } } String implementation = ((ServiceTask) execution.getCurrentFlowElement()).getImplementation(); integrationContext.setConnectorType(implementation); integrationContext.setInBoundVariables(buildInBoundVariables( actionDefinition, execution)); return integrationContext; }
String deleteReason = createDeleteReason(execution.getCurrentActivityId()); commandContext.getHistoryManager().recordProcessInstanceEnd(scopeExecutionEntity.getId(), deleteReason, execution.getCurrentActivityId());
/** * Returns the current {@link FlowElement} where the {@link DelegateExecution} is currently at. */ public static FlowElement getFlowElement(DelegateExecution execution) { BpmnModel bpmnModel = getBpmnModel(execution); FlowElement flowElement = bpmnModel.getFlowElement(execution.getCurrentActivityId()); if (flowElement == null) { throw new ActivitiException("Could not find a FlowElement for activityId " + execution.getCurrentActivityId()); } return flowElement; }
private int getLastStepIndex(DelegateExecution context) throws SLException { String activityId = context.getCurrentActivityId(); String lastTaskId = progressMessageService.findLastTaskId(getCorrelationId(context), activityId); if (lastTaskId == null) { return stepIndexProvider.getDefaultStepIndex(context); } return Integer.parseInt(lastTaskId.substring(activityId.length())); }
private void logTaskStartup(DelegateExecution context, String indexedStepName) { String message = format(Messages.EXECUTING_ACTIVITI_TASK, context.getId(), context.getCurrentActivityId()); progressMessageService.add(new ProgressMessage(getCorrelationId(context), indexedStepName, ProgressMessageType.TASK_STARTUP, message, new Timestamp(System.currentTimeMillis()))); }
/** * Sets a workflow variable name based on the template. * * @param execution the workflow execution * @param variableName the variable name * @param variableValue the variable value */ public void setTaskWorkflowVariable(DelegateExecution execution, String variableName, Object variableValue) { setTaskWorkflowVariable(execution.getId(), execution.getCurrentActivityId(), variableName, variableValue); }
/** * Sets a workflow variable name based on the template. * * @param execution the workflow execution * @param variableName the variable name * @param variableValue the variable value */ public void setTaskWorkflowVariable(DelegateExecution execution, String variableName, Object variableValue) { setTaskWorkflowVariable(execution.getId(), execution.getCurrentActivityId(), variableName, variableValue); }
@Override public void notify(DelegateExecution execution) throws Exception { // log result only in the simulation context if (SimulationContext.getSimulationRun() != null) { // log costs RuntimeService runtimeService = SimulationContext.getSimulationEngineConfiguration().getRuntimeService(); Map<String, Object> resultVariables = new HashMap<String, Object>(); resultVariables.put("processDefinitionKey", execution.getProcessDefinitionId()); resultVariables.put("taskDefinitionKey", execution.getCurrentActivityId()); resultVariables.put( "description", (String) costsValue.getValue(execution)); runtimeService.saveResult((String) costsId.getValue(execution), resultVariables); } }
protected void terminateAllBehaviour(DelegateExecution execution, CommandContext commandContext, ExecutionEntityManager executionEntityManager) { ExecutionEntity rootExecutionEntity = executionEntityManager.findByRootProcessInstanceId(execution.getRootProcessInstanceId()); String deleteReason = createDeleteReason(execution.getCurrentActivityId()); deleteExecutionEntities(executionEntityManager, rootExecutionEntity, deleteReason); endAllHistoricActivities(rootExecutionEntity.getId(), deleteReason); commandContext.getHistoryManager().recordProcessInstanceEnd(rootExecutionEntity.getId(), deleteReason, execution.getCurrentActivityId()); }
public void execute(DelegateExecution execution) { JobManager jobManager = Context.getCommandContext().getJobManager(); // end date should be ignored for intermediate timer events. TimerJobEntity timerJob = jobManager.createTimerJob(timerEventDefinition, false, (ExecutionEntity) execution, TriggerTimerEventJobHandler.TYPE, TimerEventHandler.createConfiguration(execution.getCurrentActivityId(), null, timerEventDefinition.getCalendarName())); if (timerJob != null) { jobManager.scheduleTimerJob(timerJob); } }
@Override public void execute(DelegateExecution execution) { ExecutionEntity executionEntity = (ExecutionEntity) execution; if (!(execution.getCurrentFlowElement() instanceof BoundaryEvent)) { throw new ActivitiException("Programmatic error: " + this.getClass() + " should not be used for anything else than a boundary event"); } JobManager jobManager = Context.getCommandContext().getJobManager(); TimerJobEntity timerJob = jobManager.createTimerJob(timerEventDefinition, interrupting, executionEntity, TriggerTimerEventJobHandler.TYPE, TimerEventHandler.createConfiguration(execution.getCurrentActivityId(), timerEventDefinition.getEndDate(), timerEventDefinition.getCalendarName())); if (timerJob != null) { jobManager.scheduleTimerJob(timerJob); } }
@Override protected void postExecuteStep(DelegateExecution context, ExecutionStatus status) { try { getStepHelper().postExecuteStep(context, status); } catch (SLException e) { getStepHelper().storeExceptionInProgressMessageService(context, e); logException(context, e); throw e; } if (ExecutionStatus.LOGICAL_RETRY.equals(status)) { context.setVariable(Constants.RETRY_STEP_NAME, context.getCurrentActivityId()); } }
private IntegrationContextImpl buildFromExecution(DelegateExecution execution) { IntegrationContextImpl integrationContext = new IntegrationContextImpl(); integrationContext.setProcessInstanceId(execution.getProcessInstanceId()); integrationContext.setProcessDefinitionId(execution.getProcessDefinitionId()); integrationContext.setActivityElementId(execution.getCurrentActivityId()); integrationContext.setConnectorType(((ServiceTask) execution.getCurrentFlowElement()).getImplementation()); integrationContext.setInBoundVariables(execution.getVariables()); return integrationContext; } }