public Gateway findLastGateway() { FlowNode lastGateway = element; while (true) { try { lastGateway = lastGateway.getPreviousNodes().singleResult(); if (lastGateway instanceof Gateway) { return (Gateway) lastGateway; } } catch (BpmnModelException e) { throw new BpmnModelException("Unable to determine an unique previous gateway of " + lastGateway.getId(), e); } } }
/** * Sets the target flow node of this sequence flow. * * @param target the target of this sequence flow * @return the builder object */ public B to(FlowNode target) { element.setTarget(target); target.getIncoming().add(element); return myself; }
/** * Sets the source flow node of this sequence flow. * * @param source the source of this sequence flow * @return the builder object */ public B from(FlowNode source) { element.setSource(source); source.getOutgoing().add(element); return myself; }
@SuppressWarnings("rawtypes") public AbstractFlowNodeBuilder connectTo(String identifier) { ModelElementInstance target = modelInstance.getModelElementById(identifier); if (target == null) { throw new BpmnModelException("Unable to connect " + element.getId() + " to element " + identifier + " cause it not exists."); } else if (!(target instanceof FlowNode)) { throw new BpmnModelException("Unable to connect " + element.getId() + " to element " + identifier + " cause its not a flow node."); } else { FlowNode targetNode = (FlowNode) target; connectTarget(targetNode); return targetNode.builder(); } }
public ModifiableBpmnModelInstance removeFlowNode(String flowNodeId) { FlowNode flowNode = getModelElementById(flowNodeId); ModelElementInstance scope = flowNode.getParentElement(); for (SequenceFlow outgoingFlow : flowNode.getOutgoing()) { removeBpmnEdge(outgoingFlow); scope.removeChildElement(outgoingFlow); } for (SequenceFlow incomingFlow : flowNode.getIncoming()) { removeBpmnEdge(incomingFlow); scope.removeChildElement(incomingFlow); } Collection<Association> associations = scope.getChildElementsByType(Association.class); for (Association association : associations) { if (flowNode.equals(association.getSource()) || flowNode.equals(association.getTarget())) { removeBpmnEdge(association); scope.removeChildElement(association); } } removeBpmnShape(flowNode); scope.removeChildElement(flowNode); return this; }
private Set<String> getDefinitionSequenceFlowIds() { final Set<String> definitionFlowNodeIds = new HashSet<String>(); for (FlowNode activity : definitionFlowNodes) { definitionFlowNodeIds.add(activity.getId()); } return definitionFlowNodeIds; }
protected void connectTargetWithAssociation(FlowNode target) { Association association = modelInstance.newInstance(Association.class); association.setTarget(target); association.setSource(element); association.setAssociationDirection(AssociationDirection.One); element.getParentElement().addChildElement(association); createEdge(association); }
/** * Sets the Camunda asyncAfter attribute for the build flow node. * * @param asyncAfter * boolean value to set * @return the builder object */ public B camundaAsyncAfter(boolean asyncAfter) { element.setCamundaAsyncAfter(asyncAfter); return myself; }
/** * Sets the Camunda exclusive attribute to true. * * @return the builder object */ public B notCamundaExclusive() { element.setCamundaExclusive(false); return myself; }
/** * Sets the Camunda asyncBefore attribute to true. * * @return the builder object */ public B camundaAsyncBefore() { element.setCamundaAsyncBefore(true); return myself; }
@SuppressWarnings("unchecked") protected <T extends AbstractFlowNodeBuilder, F extends FlowNode> T createTargetBuilder(Class<F> typeClass, String id) { AbstractFlowNodeBuilder builder = createTarget(typeClass, id).builder(); if (compensationStarted) { // pass on current boundary event to return after compensationDone call builder.compensateBoundaryEvent = compensateBoundaryEvent; } return (T) builder; }
public B camundaJobPriority(String jobPriority) { element.setCamundaJobPriority(jobPriority); return myself; }
public ModifiableBpmnModelInstance removeFlowNode(String flowNodeId) { FlowNode flowNode = getModelElementById(flowNodeId); ModelElementInstance scope = flowNode.getParentElement(); for (SequenceFlow outgoingFlow : flowNode.getOutgoing()) { removeBpmnEdge(outgoingFlow); scope.removeChildElement(outgoingFlow); } for (SequenceFlow incomingFlow : flowNode.getIncoming()) { removeBpmnEdge(incomingFlow); scope.removeChildElement(incomingFlow); } Collection<Association> associations = scope.getChildElementsByType(Association.class); for (Association association : associations) { if (flowNode.equals(association.getSource()) || flowNode.equals(association.getTarget())) { removeBpmnEdge(association); scope.removeChildElement(association); } } removeBpmnShape(flowNode); scope.removeChildElement(flowNode); return this; }
@SuppressWarnings("rawtypes") public AbstractFlowNodeBuilder connectTo(String identifier) { ModelElementInstance target = modelInstance.getModelElementById(identifier); if (target == null) { throw new BpmnModelException("Unable to connect " + element.getId() + " to element " + identifier + " cause it not exists."); } else if (!(target instanceof FlowNode)) { throw new BpmnModelException("Unable to connect " + element.getId() + " to element " + identifier + " cause its not a flow node."); } else { FlowNode targetNode = (FlowNode) target; connectTarget(targetNode); return targetNode.builder(); } }
private void addEventToCoverage(ProcessDefinition processDefinition, FlowNode node) { if (node instanceof IntermediateThrowEvent) { final CoveredFlowNode coveredElement = new CoveredFlowNode(processDefinition.getKey(), node.getId()); // We consider entered throw elements as also ended coveredElement.setEnded(true); coverageTestRunState.addCoveredElement(coveredElement); } }
protected void connectTargetWithAssociation(FlowNode target) { Association association = modelInstance.newInstance(Association.class); association.setTarget(target); association.setSource(element); association.setAssociationDirection(AssociationDirection.One); element.getParentElement().addChildElement(association); createEdge(association); }
/** * Sets the Camunda asyncAfter attribute to true. * * @return the builder object */ public B camundaAsyncAfter() { element.setCamundaAsyncAfter(true); return myself; }
/** * Sets the camunda exclusive attribute for the build flow node. * * @param exclusive * boolean value to set * @return the builder object */ public B camundaExclusive(boolean exclusive) { element.setCamundaExclusive(exclusive); return myself; }
/** * Sets the Camunda AsyncBefore attribute for the build flow node. * * @param asyncBefore * boolean value to set * @return the builder object */ public B camundaAsyncBefore(boolean asyncBefore) { element.setCamundaAsyncBefore(asyncBefore); return myself; }
@SuppressWarnings("rawtypes") public AbstractFlowNodeBuilder moveToNode(String identifier) { ModelElementInstance instance = modelInstance.getModelElementById(identifier); if (instance != null && instance instanceof FlowNode) { return ((FlowNode) instance).builder(); } else { throw new BpmnModelException("Flow node not found for id " + identifier); } }