protected List<ExecutionEntity> getActiveChildExecutionsForExecution(ExecutionEntityManager executionEntityManager, String executionId) { List<ExecutionEntity> activeChildExecutions = new ArrayList<ExecutionEntity>(); List<ExecutionEntity> executions = executionEntityManager.findChildExecutionsByParentExecutionId(executionId); for (ExecutionEntity activeExecution : executions) { if (!(activeExecution.getCurrentFlowElement() instanceof BoundaryEvent)) { activeChildExecutions.add(activeExecution); } } return activeChildExecutions; }
protected int getNumberOfActiveChildExecutionsForExecution(ExecutionEntityManager executionEntityManager, String executionId) { List<ExecutionEntity> executions = executionEntityManager.findChildExecutionsByParentExecutionId(executionId); int activeExecutions = 0; // Filter out the boundary events for (ExecutionEntity activeExecution : executions) { if (!(activeExecution.getCurrentFlowElement() instanceof BoundaryEvent)) { activeExecutions++; } } return activeExecutions; }
@SuppressWarnings({ "unchecked", "rawtypes" }) protected void ensureExecutionsInitialized() { if (executions == null) { this.executions = (List) Context.getCommandContext().getExecutionEntityManager().findChildExecutionsByParentExecutionId(id); } }
private ExecutionEntityManager deleteAllChildExecutions(ExecutionEntityManager executionEntityManager, ExecutionEntity scopeExecution) { // Delete all child executions Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(scopeExecution.getId()); for (ExecutionEntity childExecution : childExecutions) { executionEntityManager.deleteExecutionAndRelatedData(childExecution, execution.getDeleteReason(), false); } return executionEntityManager; } }
protected boolean isAllEventScopeExecutions(ExecutionEntityManager executionEntityManager, ExecutionEntity parentExecution) { boolean allEventScopeExecutions = true; List<ExecutionEntity> executions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId()); for (ExecutionEntity childExecution : executions) { if (childExecution.isEventScope()) { executionEntityManager.deleteExecutionAndRelatedData(childExecution, null, false); } else { allEventScopeExecutions = false; break; } } return allEventScopeExecutions; }
protected void deleteChildExecutions(ExecutionEntity parentExecution, boolean deleteExecution, CommandContext commandContext) { // Delete all child executions ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId()); if (CollectionUtil.isNotEmpty(childExecutions)) { for (ExecutionEntity childExecution : childExecutions) { deleteChildExecutions(childExecution, true, commandContext); } } if (deleteExecution) { executionEntityManager.deleteExecutionAndRelatedData(parentExecution, null, false); } }
protected void deleteChildExecutions(ExecutionEntity parentExecution, ExecutionEntity notToDeleteExecution, CommandContext commandContext, String deleteReason) { // Delete all child executions ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId()); if (CollectionUtil.isNotEmpty(childExecutions)) { for (ExecutionEntity childExecution : childExecutions) { if (!(childExecution.getId().equals(notToDeleteExecution.getId()))) { deleteChildExecutions(childExecution, notToDeleteExecution, commandContext, deleteReason); } } } executionEntityManager.deleteExecutionAndRelatedData(parentExecution, deleteReason, false); }
protected void cleanupExecutions(FlowElement currentFlowElement) { if (execution.getParentId() != null && execution.isScope()) { // If the execution is a scope (and not a process instance), the scope must first be // destroyed before we can continue and follow the sequence flow Context.getAgenda().planDestroyScopeOperation(execution); } else if (currentFlowElement instanceof Activity) { // If the current activity is an activity, we need to remove any currently active boundary events Activity activity = (Activity) currentFlowElement; if (CollectionUtil.isNotEmpty(activity.getBoundaryEvents())) { // Cancel events are not removed List<String> notToDeleteEvents = new ArrayList<String>(); for (BoundaryEvent event : activity.getBoundaryEvents()) { if (CollectionUtil.isNotEmpty(event.getEventDefinitions()) && event.getEventDefinitions().get(0) instanceof CancelEventDefinition) { notToDeleteEvents.add(event.getId()); } } // Delete all child executions Collection<ExecutionEntity> childExecutions = commandContext.getExecutionEntityManager().findChildExecutionsByParentExecutionId(execution.getId()); for (ExecutionEntity childExecution : childExecutions) { if (childExecution.getCurrentFlowElement() == null || !notToDeleteEvents.contains(childExecution.getCurrentFlowElement().getId())) { commandContext.getExecutionEntityManager().deleteExecutionAndRelatedData(childExecution, null, false); } } } } }
protected void deleteChildExecutions(ExecutionEntity parentExecution, ExecutionEntity notToDeleteExecution, CommandContext commandContext) { // TODO: would be good if this deleteChildExecutions could be removed and the one on the executionEntityManager is used // The problem however, is that the 'notToDeleteExecution' is passed here. // This could be solved by not reusing an execution, but creating a new // Delete all child executions ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId()); if (CollectionUtil.isNotEmpty(childExecutions)) { for (ExecutionEntity childExecution : childExecutions) { if (childExecution.getId().equals(notToDeleteExecution.getId()) == false) { deleteChildExecutions(childExecution, notToDeleteExecution, commandContext); } } } String deleteReason = DeleteReason.BOUNDARY_EVENT_INTERRUPTING + " (" + notToDeleteExecution.getCurrentActivityId() + ")"; if (parentExecution.getCurrentFlowElement() instanceof CallActivity) { ExecutionEntity subProcessExecution = executionEntityManager.findSubProcessInstanceBySuperExecutionId(parentExecution.getId()); if (subProcessExecution != null) { executionEntityManager.deleteProcessInstanceExecutionEntity(subProcessExecution.getId(), subProcessExecution.getCurrentActivityId(), deleteReason, true, true); } } executionEntityManager.deleteExecutionAndRelatedData(parentExecution, deleteReason, false); }
protected void dispatchExecutionCancelled(DelegateExecution execution, FlowElement terminateEndEvent) { ExecutionEntityManager executionEntityManager = Context.getCommandContext().getExecutionEntityManager(); // subprocesses for (DelegateExecution subExecution : executionEntityManager.findChildExecutionsByParentExecutionId(execution.getId())) { dispatchExecutionCancelled(subExecution, terminateEndEvent); } // call activities ExecutionEntity subProcessInstance = Context.getCommandContext().getExecutionEntityManager().findSubProcessInstanceBySuperExecutionId(execution.getId()); if (subProcessInstance != null) { dispatchExecutionCancelled(subProcessInstance, terminateEndEvent); } // activity with message/signal boundary events FlowElement currentFlowElement = execution.getCurrentFlowElement(); if (currentFlowElement instanceof FlowNode) { dispatchActivityCancelled(execution, terminateEndEvent); } }
protected void dispatchActivityCancelledForChildExecution(EventSubscriptionEntity eventSubscription, ExecutionEntity parentExecutionEntity, ExecutionEntity boundaryEventExecution, CommandContext commandContext) { List<ExecutionEntity> executionEntities = commandContext.getExecutionEntityManager().findChildExecutionsByParentExecutionId(parentExecutionEntity.getId()); for (ExecutionEntity childExecution : executionEntities) { if (!boundaryEventExecution.getId().equals(childExecution.getId()) && childExecution.getCurrentFlowElement() != null && childExecution.getCurrentFlowElement() instanceof FlowNode) { FlowNode flowNode = (FlowNode) childExecution.getCurrentFlowElement(); commandContext.getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createActivityCancelledEvent(flowNode.getId(), flowNode.getName(), childExecution.getId(), childExecution.getProcessInstanceId(), childExecution.getProcessDefinitionId(), parseActivityType(flowNode), eventSubscription)); if (childExecution.isScope()) { dispatchActivityCancelledForChildExecution(eventSubscription, childExecution, boundaryEventExecution, commandContext); } } } }
List<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(executionEntity.getParentId()); for (ExecutionEntity childExecution : childExecutions) { if (!childExecution.getId().equals(executionEntity.getId())) {
boolean endAdhocSubProcess = true; if (!adhocSubProcess.isCancelRemainingInstances()) { List<ExecutionEntity> childExecutions = commandContext.getExecutionEntityManager().findChildExecutionsByParentExecutionId(execution.getParentId()); for (ExecutionEntity executionEntity : childExecutions) { if (!executionEntity.getId().equals(execution.getId())) {
if (activity.getLoopCharacteristics() != null) { ExecutionEntity miExecution = subProcessExecution.getParent(); List<ExecutionEntity> miChildExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(miExecution.getId()); for (ExecutionEntity miChildExecution : miChildExecutions) { if (subProcessExecution.getId().equals(miChildExecution.getId()) == false && activity.getId().equals(miChildExecution.getCurrentActivityId())) {
protected int getNumberOfActiveChildExecutionsForExecution(ExecutionEntityManager executionEntityManager, String executionId) { List<ExecutionEntity> executions = executionEntityManager.findChildExecutionsByParentExecutionId(executionId); int activeExecutions = 0; // Filter out the boundary events for (ExecutionEntity activeExecution : executions) { if (!(activeExecution.getCurrentFlowElement() instanceof BoundaryEvent)) { activeExecutions++; } } return activeExecutions; }
protected List<ExecutionEntity> getActiveChildExecutionsForExecution(ExecutionEntityManager executionEntityManager, String executionId) { List<ExecutionEntity> activeChildExecutions = new ArrayList<ExecutionEntity>(); List<ExecutionEntity> executions = executionEntityManager.findChildExecutionsByParentExecutionId(executionId); for (ExecutionEntity activeExecution : executions) { if (!(activeExecution.getCurrentFlowElement() instanceof BoundaryEvent)) { activeChildExecutions.add(activeExecution); } } return activeChildExecutions; }
@SuppressWarnings({ "unchecked", "rawtypes" }) protected void ensureExecutionsInitialized() { if (executions == null) { this.executions = (List) Context.getCommandContext().getExecutionEntityManager().findChildExecutionsByParentExecutionId(id); } }
@SuppressWarnings({"unchecked", "rawtypes"}) protected void ensureExecutionsInitialized() { if (executions == null) { this.executions = Context .getCommandContext() .getExecutionEntityManager() .findChildExecutionsByParentExecutionId(id); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) protected void ensureExecutionsInitialized() { if (executions==null) { this.executions = (List) Context .getCommandContext() .getExecutionEntityManager() .findChildExecutionsByParentExecutionId(id); } }
protected void deleteChildExecutions(ExecutionEntity parentExecution, boolean deleteExecution, CommandContext commandContext) { // Delete all child executions ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId()); if (CollectionUtil.isNotEmpty(childExecutions)) { for (ExecutionEntity childExecution : childExecutions) { deleteChildExecutions(childExecution, true, commandContext); } } if (deleteExecution) { executionEntityManager.deleteExecutionAndRelatedData(parentExecution, null, false); } }