@Override public void removeFlowElement(String elementId) { FlowElement element = getFlowElement(elementId); if (element != null) { flowElementList.remove(element); flowElementMap.remove(elementId); if (element.getParentContainer() != null) { element.getParentContainer().removeFlowElementFromMap(elementId); } } }
protected Process getProcessForTerminateEndEvent(FlowElement terminateEndEvent) { FlowElementsContainer parent = terminateEndEvent.getParentContainer(); while (!(parent instanceof Process)) { // FlowElementsContainer can only be Process or SubProcess (and its subtypes) SubProcess subProcess = (SubProcess) parent; parent = subProcess.getParentContainer(); } return (Process) parent; }
@Override public void removeFlowElement(String elementId) { FlowElement element = getFlowElement(elementId); if (element != null) { flowElementList.remove(element); flowElementMap.remove(elementId); if (element.getParentContainer() != null) { element.getParentContainer().removeFlowElementFromMap(elementId); } } }
protected static boolean isInEventSubprocess(FlowNode flowNode) { FlowElementsContainer flowElementsContainer = flowNode.getParentContainer(); while (flowElementsContainer != null) { if (flowElementsContainer instanceof EventSubProcess) { return true; } if (flowElementsContainer instanceof FlowElement) { flowElementsContainer = ((FlowElement) flowElementsContainer).getParentContainer(); } else { flowElementsContainer = null; } } return false; }
protected Optional<String> getFlowElementMultiInstanceParentId(FlowElement flowElement) { FlowElementsContainer parentContainer = flowElement.getParentContainer(); while (parentContainer instanceof Activity) { if (isFlowElementMultiInstance((Activity) parentContainer)) { return Optional.of(((Activity) parentContainer).getId()); } parentContainer = ((Activity) parentContainer).getParentContainer(); } return Optional.empty(); }
for (FlowElement flowElement : duplicateFlowElement.getParentContainer().getFlowElements()) { if (flowElement instanceof SequenceFlow) { SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
@Override public void trigger(DelegateExecution execution, String triggerName, Object triggerData) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); ExecutionEntity executionEntity = (ExecutionEntity) execution; StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement(); if (startEvent.isInterrupting()) { List<ExecutionEntity> childExecutions = executionEntityManager.collectChildren(executionEntity.getParent()); for (int i = childExecutions.size() - 1; i >= 0; i--) { ExecutionEntity childExecutionEntity = childExecutions.get(i); if (!childExecutionEntity.isEnded() && !childExecutionEntity.getId().equals(executionEntity.getId())) { executionEntityManager.deleteExecutionAndRelatedData(childExecutionEntity, DeleteReason.EVENT_SUBPROCESS_INTERRUPTING + "(" + startEvent.getId() + ")", false); } } } ExecutionEntity newSubProcessExecution = executionEntityManager.createChildExecution(executionEntity.getParent()); newSubProcessExecution.setCurrentFlowElement((SubProcess) executionEntity.getCurrentFlowElement().getParentContainer()); newSubProcessExecution.setEventScope(false); newSubProcessExecution.setScope(true); ExecutionEntity outgoingFlowExecution = executionEntityManager.createChildExecution(newSubProcessExecution); outgoingFlowExecution.setCurrentFlowElement(startEvent); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(outgoingFlowExecution); leave(outgoingFlowExecution); }
newSubProcessExecution.setCurrentFlowElement((SubProcess) executionEntity.getCurrentFlowElement().getParentContainer()); newSubProcessExecution.setEventScope(false); newSubProcessExecution.setScope(true);
newSubProcessExecution.setCurrentFlowElement((SubProcess) executionEntity.getCurrentFlowElement().getParentContainer()); newSubProcessExecution.setEventScope(false); newSubProcessExecution.setScope(true);
@Override protected void updateExecutions(CommandContext commandContext, ProcessDefinitionEntity processDefinitionEntity, ExecutionEntity processInstance, List<ExecutionEntity> childExecutions) { TaskEntity taskEntity = CommandContextUtil.getTaskService().getTask(taskId); ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); ExecutionEntity executionAtTask = executionEntityManager.findById(taskEntity.getExecutionId()); BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionEntity.getId()); FlowElement taskElement = bpmnModel.getFlowElement(executionAtTask.getCurrentActivityId()); FlowElement subProcessElement = bpmnModel.getFlowElement(((SubProcess) taskElement.getParentContainer()).getId()); ExecutionEntity subProcessExecution = executionEntityManager.createChildExecution(executionAtTask.getParent()); subProcessExecution.setScope(true); subProcessExecution.setCurrentFlowElement(subProcessElement); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(subProcessExecution); executionAtTask.setParent(subProcessExecution); ExecutionEntity taskExecution = executionEntityManager.createChildExecution(subProcessExecution); FlowElement userTaskElement = bpmnModel.getFlowElement(dynamicUserTaskBuilder.getDynamicTaskId()); taskExecution.setCurrentFlowElement(userTaskElement); Context.getAgenda().planContinueProcessOperation(taskExecution); } }
@Override protected void updateExecutions(CommandContext commandContext, ProcessDefinitionEntity processDefinitionEntity, ExecutionEntity processInstance, List<ExecutionEntity> childExecutions) { ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); TaskEntity taskEntity = CommandContextUtil.getTaskService().getTask(taskId); ExecutionEntity executionAtTask = executionEntityManager.findById(taskEntity.getExecutionId()); BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionEntity.getId()); FlowElement taskElement = bpmnModel.getFlowElement(executionAtTask.getCurrentActivityId()); FlowElement subProcessElement = bpmnModel.getFlowElement(((SubProcess) taskElement.getParentContainer()).getId()); ExecutionEntity subProcessExecution = executionEntityManager.createChildExecution(executionAtTask.getParent()); subProcessExecution.setScope(true); subProcessExecution.setCurrentFlowElement(subProcessElement); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(subProcessExecution); executionAtTask.setParent(subProcessExecution); ExecutionEntity execution = executionEntityManager.createChildExecution(subProcessExecution); FlowElement newSubProcess = bpmnModel.getMainProcess().getFlowElement(dynamicEmbeddedSubProcessBuilder.getDynamicSubProcessId(), true); execution.setCurrentFlowElement(newSubProcess); CommandContextUtil.getAgenda().planContinueProcessOperation(execution); }
duplicateFlowElement.getParentContainer().removeFlowElementFromMap(originalFlowElementId); duplicateFlowElement.getParentContainer().addFlowElementToMap(duplicateFlowElement);
duplicateFlowElement.getParentContainer().removeFlowElementFromMap(originalFlowElementId); duplicateFlowElement.getParentContainer().addFlowElementToMap(duplicateFlowElement);