protected void setWaypoints(BpmnEdge edge) { BaseElement bpmnElement = edge.getBpmnElement(); FlowNode edgeSource; FlowNode edgeTarget; if (bpmnElement instanceof SequenceFlow) { SequenceFlow sequenceFlow = (SequenceFlow) bpmnElement; edgeSource = sequenceFlow.getSource(); edgeTarget = sequenceFlow.getTarget(); } else if (bpmnElement instanceof Association){ Association association = (Association) bpmnElement; edgeSource = (FlowNode) association.getSource(); edgeTarget = (FlowNode) association.getTarget(); } else { throw new RuntimeException("Bpmn element type not supported"); } setWaypointsWithSourceAndTarget(edge, edgeSource, edgeTarget); }
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); }
public static void addUserTaskCompensationHandler(BpmnModelInstance modelInstance, String boundaryEventId, String compensationHandlerId) { BoundaryEvent boundaryEvent = modelInstance.getModelElementById(boundaryEventId); BaseElement scope = (BaseElement) boundaryEvent.getParentElement(); UserTask compensationHandler = modelInstance.newInstance(UserTask.class); compensationHandler.setId(compensationHandlerId); compensationHandler.setForCompensation(true); scope.addChildElement(compensationHandler); Association association = modelInstance.newInstance(Association.class); association.setAssociationDirection(AssociationDirection.One); association.setSource(boundaryEvent); association.setTarget(compensationHandler); scope.addChildElement(association); }
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 void addServiceTaskCompensationHandler(BpmnModelInstance modelInstance, String boundaryEventId, String compensationHandlerId) { BoundaryEvent boundaryEvent = modelInstance.getModelElementById(boundaryEventId); BaseElement scope = (BaseElement) boundaryEvent.getParentElement(); ServiceTask compensationHandler = modelInstance.newInstance(ServiceTask.class); compensationHandler.setId(compensationHandlerId); compensationHandler.setForCompensation(true); compensationHandler.setCamundaClass(IncreaseCurrentTimeServiceTask.class.getName()); scope.addChildElement(compensationHandler); Association association = modelInstance.newInstance(Association.class); association.setAssociationDirection(AssociationDirection.One); association.setSource(boundaryEvent); association.setTarget(compensationHandler); scope.addChildElement(association); }
protected void setWaypoints(BpmnEdge edge) { BaseElement bpmnElement = edge.getBpmnElement(); FlowNode edgeSource; FlowNode edgeTarget; if (bpmnElement instanceof SequenceFlow) { SequenceFlow sequenceFlow = (SequenceFlow) bpmnElement; edgeSource = sequenceFlow.getSource(); edgeTarget = sequenceFlow.getTarget(); } else if (bpmnElement instanceof Association){ Association association = (Association) bpmnElement; edgeSource = (FlowNode) association.getSource(); edgeTarget = (FlowNode) association.getTarget(); } else { throw new RuntimeException("Bpmn element type not supported"); } setWaypointsWithSourceAndTarget(edge, edgeSource, edgeTarget); }
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); }
protected void setWaypoints(BpmnEdge edge) { BaseElement bpmnElement = edge.getBpmnElement(); FlowNode edgeSource; FlowNode edgeTarget; if (bpmnElement instanceof SequenceFlow) { SequenceFlow sequenceFlow = (SequenceFlow) bpmnElement; edgeSource = sequenceFlow.getSource(); edgeTarget = sequenceFlow.getTarget(); } else if (bpmnElement instanceof Association){ Association association = (Association) bpmnElement; edgeSource = (FlowNode) association.getSource(); edgeTarget = (FlowNode) association.getTarget(); } else { throw new RuntimeException("Bpmn element type not supported"); } setWaypointsWithSourceAndTarget(edge, edgeSource, edgeTarget); }
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); }
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; }
public static void addUserTaskCompensationHandler(BpmnModelInstance modelInstance, String boundaryEventId, String compensationHandlerId) { BoundaryEvent boundaryEvent = modelInstance.getModelElementById(boundaryEventId); BaseElement scope = (BaseElement) boundaryEvent.getParentElement(); UserTask compensationHandler = modelInstance.newInstance(UserTask.class); compensationHandler.setId(compensationHandlerId); compensationHandler.setForCompensation(true); scope.addChildElement(compensationHandler); Association association = modelInstance.newInstance(Association.class); association.setAssociationDirection(AssociationDirection.One); association.setSource(boundaryEvent); association.setTarget(compensationHandler); scope.addChildElement(association); }
private void addServiceTaskCompensationHandler(BpmnModelInstance modelInstance, String boundaryEventId, String compensationHandlerId) { BoundaryEvent boundaryEvent = modelInstance.getModelElementById(boundaryEventId); BaseElement scope = (BaseElement) boundaryEvent.getParentElement(); ServiceTask compensationHandler = modelInstance.newInstance(ServiceTask.class); compensationHandler.setId(compensationHandlerId); compensationHandler.setForCompensation(true); compensationHandler.setCamundaClass(IncreaseCurrentTimeServiceTask.class.getName()); scope.addChildElement(compensationHandler); Association association = modelInstance.newInstance(Association.class); association.setAssociationDirection(AssociationDirection.One); association.setSource(boundaryEvent); association.setTarget(compensationHandler); scope.addChildElement(association); }