Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.FlowNode


   
    flowElementNode.put(EDITOR_SHAPE_PROPERTIES, propertiesNode);
    ArrayNode outgoingArrayNode = objectMapper.createArrayNode();
   
    if (flowElement instanceof FlowNode) {
      FlowNode flowNode = (FlowNode) flowElement;
      for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) {
        outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(sequenceFlow.getId()));
      }
    }
   
    if (flowElement instanceof Activity) {
View Full Code Here


 
  private void processFlowElements(Collection<FlowElement> flowElementList, BaseElement parentScope) {
    for (FlowElement flowElement : flowElementList) {
      if (flowElement instanceof SequenceFlow) {
        SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
        FlowNode sourceNode = getFlowNodeFromScope(sequenceFlow.getSourceRef(), parentScope);
        if (sourceNode != null) {
          sourceNode.getOutgoingFlows().add(sequenceFlow);
        }
        FlowNode targetNode = getFlowNodeFromScope(sequenceFlow.getTargetRef(), parentScope);
        if (targetNode != null) {
          targetNode.getIncomingFlows().add(sequenceFlow);
        }
      } else if (flowElement instanceof BoundaryEvent) {
        BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
        FlowElement attachedToElement = getFlowNodeFromScope(boundaryEvent.getAttachedToRefId(), parentScope);
        if(attachedToElement != null) {
View Full Code Here

      }
    }
  }
 
  private FlowNode getFlowNodeFromScope(String elementId, BaseElement scope) {
    FlowNode flowNode = null;
    if (StringUtils.isNotEmpty(elementId)) {
      if (scope instanceof Process) {
        flowNode = (FlowNode) ((Process) scope).getFlowElement(elementId);
      } else if (scope instanceof SubProcess) {
        flowNode = (FlowNode) ((SubProcess) scope).getFlowElement(elementId);
View Full Code Here

    Anchor sourceAnchor = null;
    Anchor targetAnchor = null;
    if(addConContext.getSourceAnchor() == null) {
      EList<Shape> shapeList = getDiagram().getChildren();
      for (Shape shape : shapeList) {
        FlowNode flowNode = (FlowNode) getBusinessObjectForPictogramElement(shape.getGraphicsAlgorithm().getPictogramElement());
        if(flowNode == null || flowNode.getId() == null || addedSequenceFlow.getSourceRef() == null ||
                addedSequenceFlow.getTargetRef() == null) continue;
        if(flowNode.getId().equals(addedSequenceFlow.getSourceRef())) {
          EList<Anchor> anchorList = ((ContainerShape) shape).getAnchors();
          for (Anchor anchor : anchorList) {
            if(anchor instanceof ChopboxAnchor) {
              sourceAnchor = anchor;
              break;
            }
          }
        }
       
        if(flowNode.getId().equals(addedSequenceFlow.getTargetRef())) {
          EList<Anchor> anchorList = ((ContainerShape) shape).getAnchors();
          for (Anchor anchor : anchorList) {
            if(anchor instanceof ChopboxAnchor) {
              targetAnchor = anchor;
              break;
View Full Code Here

       
        getDiagram().getPictogramLinks().remove(pictogramElement.getLink());
        getDiagram().getConnections().remove(pictogramElement);
       
        Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
        FlowNode sourceNode = null;
        String sourceRef = sequenceFlow.getSourceRef();
        if (StringUtils.isNotEmpty(sourceRef)) {
          sourceNode = (FlowNode) model.getBpmnModel().getFlowElement(sourceRef);
        }
       
        FlowNode targetNode = null;
        String targetRef = sequenceFlow.getTargetRef();
        if (StringUtils.isNotEmpty(targetRef)) {
          targetNode = (FlowNode) model.getBpmnModel().getFlowElement(targetRef);
        }
       
        if (sourceNode != null) {
          sourceNode.getOutgoingFlows().remove(sequenceFlow);
        }
       
        if (targetNode != null) {
          targetNode.getIncomingFlows().remove(sequenceFlow);
        }
       
        List<Process> processes = model.getBpmnModel().getProcesses();
        for (Process process : processes) {
          process.removeFlowElement(sequenceFlow.getId());
View Full Code Here

    // provide name and description for the UI, e.g. the palette
    super(fp, "SequenceFlow", "Create SequenceFlow"); //$NON-NLS-1$ //$NON-NLS-2$
  }

  public boolean canCreate(ICreateConnectionContext context) {
    FlowNode source = getFlowNode(context.getSourceAnchor());
    FlowNode target = getFlowNode(context.getTargetAnchor());
    if (source != null && target != null && source != target) {
      if (source instanceof StartEvent && target instanceof StartEvent) {
        return false;
      } else if (source instanceof EndEvent) {
        // prevent adding outgoing connections from EndEvents
View Full Code Here

  }

  public Connection create(ICreateConnectionContext context) {
    Connection newConnection = null;

    FlowNode source = getFlowNode(context.getSourceAnchor());
    FlowNode target = getFlowNode(context.getTargetAnchor());

    if (source != null && target != null) {
      // create new business object
      SequenceFlow sequenceFlow = createSequenceFlow(source, target, context);
View Full Code Here

   
    SequenceFlow flow = (SequenceFlow) connectionObject;
   
    Object targetObject = getFeatureProvider().getBusinessObjectForPictogramElement(context.getTargetPictogramElement());
    if(targetObject instanceof FlowNode == false) return;
    FlowNode targetElement = (FlowNode) targetObject;
   
    if(ReconnectionContext.RECONNECT_TARGET.equalsIgnoreCase(context.getReconnectType())) {
      List<SequenceFlow> flowList = targetElement.getIncomingFlows();
      boolean found = false;
      for (SequenceFlow sequenceFlow : flowList) {
        if(sequenceFlow.getId().equals(flow.getId())) {
          found = true;
        }
      }
     
      if(found == false) {
       
        FlowNode targetFlowNode = (FlowNode) model.getBpmnModel().getFlowElement(flow.getTargetRef());
      
        if (targetFlowNode != null) {
          // remove old target
          targetFlowNode.getIncomingFlows().remove(flow);
        }
       
        targetElement.getIncomingFlows().add(flow);
        flow.setTargetRef(targetElement.getId());
      }
     
    } else if(ReconnectionContext.RECONNECT_SOURCE.equalsIgnoreCase(context.getReconnectType())) {
      // targetElement is the source side of the sequence flow
      List<SequenceFlow> flowList = targetElement.getOutgoingFlows();
      boolean found = false;
      for (SequenceFlow sequenceFlow : flowList) {
        if(sequenceFlow.equals(flow)) {
          found = true;
        }
      }
     
      if(found == false) {
       
        FlowNode sourceFlowNode = (FlowNode) model.getBpmnModel().getFlowElement(flow.getSourceRef());
        ContainerShape sourceElement = (ContainerShape) getFeatureProvider().getPictogramElementForBusinessObject(sourceFlowNode);
        ContainerShape oldParentContainer = sourceElement.getContainer();
        ContainerShape newParentContainer = ((ContainerShape) context.getTargetPictogramElement()).getContainer();
       
        if (oldParentContainer != newParentContainer) {
         
          if (oldParentContainer instanceof Diagram) {
            ModelHandler.getModel(EcoreUtil.getURI(getDiagram())).getBpmnModel().getMainProcess().removeFlowElement(flow.getId());

          } else {
            Object parentObject = getFeatureProvider().getBusinessObjectForPictogramElement(oldParentContainer);
            if (parentObject instanceof SubProcess) {
              ((SubProcess) parentObject).removeFlowElement(flow.getId());

            } else if (parentObject instanceof Lane) {
              Lane lane = (Lane) parentObject;
              lane.getParentProcess().removeFlowElement(flow.getId());
            }
          }
         
          if (newParentContainer instanceof Diagram) {
            ModelHandler.getModel(EcoreUtil.getURI(getDiagram())).getBpmnModel().getMainProcess().addFlowElement(flow);

          } else {
            Object parentObject = getBusinessObjectForPictogramElement(newParentContainer);
            if (parentObject instanceof SubProcess) {
              ((SubProcess) parentObject).addFlowElement(flow);

            } else if (parentObject instanceof Lane) {
              Lane lane = (Lane) parentObject;
              lane.getParentProcess().addFlowElement(flow);
            }
          }
        }
       
        // remove old source
        if (sourceFlowNode != null) {
          sourceFlowNode.getOutgoingFlows().remove(flow);
        }
       
        targetElement.getOutgoingFlows().add(flow);
        flow.setSourceRef(targetElement.getId());
       
View Full Code Here

      if (removeFeature != null) {
        removeFeature.remove(rc);
      }
     
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      FlowNode sourceNode = (FlowNode) model.getFlowElement(deleteObject.getSourceRef());
      FlowNode targetNode = (FlowNode) model.getFlowElement(deleteObject.getTargetRef());
     
      if (sourceNode != null) {
        sourceNode.getOutgoingFlows().remove(deleteObject);
      }
     
      if (targetNode != null) {
        targetNode.getIncomingFlows().remove(deleteObject);
      }
     
      removeElement(deleteObject);
    }
  }
View Full Code Here

    taskContext.setTargetContainer(targetContainer);
    taskContext.setLocation(x, y);
    taskContext.setHeight(elementGraphics.getHeight());
    taskContext.setWidth(elementGraphics.getWidth());
   
    FlowNode oldObject = (FlowNode) getFeatureProvider().getBusinessObjectForPictogramElement(element);
    if (oldObject instanceof BoundaryEvent) {
      BoundaryEvent boundaryEvent = (BoundaryEvent) oldObject;
      ContainerShape parentShape = (ContainerShape) getFeatureProvider().getPictogramElementForBusinessObject(boundaryEvent.getAttachedToRef());
      taskContext.setTargetContainer(parentShape);
      taskContext.setLocation(x - parentShape.getGraphicsAlgorithm().getX(), y - parentShape.getGraphicsAlgorithm().getY());
    }
   
    List<SequenceFlow> sourceList = oldObject.getOutgoingFlows();
    List<SequenceFlow> targetList = oldObject.getIncomingFlows();
   
    taskContext.putProperty("org.activiti.designer.changetype.sourceflows", sourceList);
    taskContext.putProperty("org.activiti.designer.changetype.targetflows", targetList);
    taskContext.putProperty("org.activiti.designer.changetype.name", oldObject.getName());
   
    targetContainer.getChildren().remove(element);
    List<Process> processes = ModelHandler.getModel(EcoreUtil.getURI(getDiagram())).getBpmnModel().getProcesses();
    for (Process process : processes) {
      process.removeFlowElement(oldObject.getId());
      removeElement(oldObject, process);
    }
   
    if("servicetask".equals(newType)) {
      new CreateServiceTaskFeature(getFeatureProvider()).create(taskContext);
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.FlowNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.