Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.Association


    return ELEMENT_ASSOCIATION;
  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    Association association = new Association();
    BpmnXMLUtil.addXMLLocation(association, xtr);
    association.setSourceRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_SOURCE_REF));
    association.setTargetRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_TARGET_REF));
    association.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID));
   
    parseChildElements(getXMLElementName(), association, model, xtr);

    return association;
  }
View Full Code Here


    return association;
  }

  @Override
  protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
    Association association = (Association) element;
    writeDefaultAttribute(ATTRIBUTE_FLOW_SOURCE_REF, association.getSourceRef(), xtw);
    writeDefaultAttribute(ATTRIBUTE_FLOW_TARGET_REF, association.getTargetRef(), xtw);
  }
View Full Code Here

   
    // association
    artifactDrawInstructions.put(Association.class, new ArtifactDrawInstruction() {

      public void draw(DefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact) {
        Association association = (Association) artifact;
        String sourceRef = association.getSourceRef();
        String targetRef = association.getTargetRef();
       
        // source and target can be instance of FlowElement or Artifact
        BaseElement sourceElement = bpmnModel.getFlowElement(sourceRef);
        BaseElement targetElement = bpmnModel.getFlowElement(targetRef);
        if (sourceElement == null) {
            sourceElement = bpmnModel.getArtifact(sourceRef);
        }
        if (targetElement == null) {
            targetElement = bpmnModel.getArtifact(targetRef);
        }
        List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(artifact.getId());
        graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList);
        int xPoints[]= new int[graphicInfoList.size()];
        int yPoints[]= new int[graphicInfoList.size()];
        for (int i=1; i<graphicInfoList.size(); i++) {
            GraphicInfo graphicInfo = graphicInfoList.get(i);
            GraphicInfo previousGraphicInfo = graphicInfoList.get(i-1);
           
            if (i == 1) {
              xPoints[0] = (int) previousGraphicInfo.getX();
              yPoints[0] = (int) previousGraphicInfo.getY();
            }
            xPoints[i] = (int) graphicInfo.getX();
            yPoints[i] = (int) graphicInfo.getY();
        }

        AssociationDirection associationDirection = association.getAssociationDirection();
        processDiagramCanvas.drawAssociation(xPoints, yPoints, associationDirection, false, scaleFactor);
      }
    });
  }
View Full Code Here

          textAnnotation.setId(elementId);
          model.getGlobalArtifacts().add(textAnnotation);
         
        } else if (activeProcess == null && ELEMENT_ASSOCIATION.equals(xtr.getLocalName())) {
          String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
          Association association = (Association) new AssociationXMLConverter().convertXMLToElement(xtr, model);
          association.setId(elementId);
          model.getGlobalArtifacts().add(association);
       
        } else if (ELEMENT_EXTENSIONS.equals(xtr.getLocalName())) {
          extensionElementsParser.parse(xtr, activeSubProcessList, activeProcess, model);
       
View Full Code Here

   
    if (sourceBo == null || targetBo == null) {
      return null;
    } else {
      // create new association
      final Association association = createAssociation(sourceBo, targetBo, context);
     
      final AddConnectionContext addContext = new AddConnectionContext(sourceAnchor
                                                                     , targetAnchor);
      addContext.setNewObject(association);
     
View Full Code Here

  }
 
  private Association createAssociation(final BaseElement sourceBo, final BaseElement targetBo
                                      , final ICreateConnectionContext context) {
   
    final Association association = new Association();
   
    association.setId(getNextId());
    association.setSourceRef(sourceBo.getId());
    association.setTargetRef(targetBo.getId());
   
    final ContainerShape targetContainer = (ContainerShape) context.getSourcePictogramElement();
    final ContainerShape parentContainer = targetContainer.getContainer();
   
    if (parentContainer instanceof Diagram) {
View Full Code Here

    return FEATURE_ID_KEY;
  }
 
  @Override
  protected Class< ? extends BaseElement> getFeatureClass() {
    return new Association().getClass();
  }
View Full Code Here

      final Object bo = getBusinessObjectForPictogramElement(pictogramElement);
      if (bo == null) {
        continue;
      }

      final Association association = (Association) bo;

      getDiagram().getPictogramLinks().remove(pictogramElement.getLink());
      getDiagram().getConnections().remove(pictogramElement);

      final List<Process> processes = ModelHandler.getModel(EcoreUtil.getURI(getDiagram())).getBpmnModel().getProcesses();
View Full Code Here

  }

  @Override
  public PictogramElement add(final IAddContext context) {   
    final IAddConnectionContext addConnectionContext = (IAddConnectionContext) context;
    final Association association = (Association) context.getNewObject();
   
    Anchor sourceAnchor = addConnectionContext.getSourceAnchor();
    Anchor targetAnchor = addConnectionContext.getTargetAnchor();
   
    if (sourceAnchor == null) {
      final List<Shape> shapes = getDiagram().getChildren();
     
      for (final Shape shape : shapes) {
        final BaseElement baseElement
          = (BaseElement) getBusinessObjectForPictogramElement(shape.getGraphicsAlgorithm()
                                                                  .getPictogramElement());
        if (baseElement == null || baseElement.getId() == null
                || association.getSourceRef() == null || association.getTargetRef() == null) {
          continue;
        }
       
        if (baseElement.getId().equals(association.getSourceRef())) {
          final List<Anchor> anchors = ((ContainerShape) shape).getAnchors();
          for (final Anchor anchor : anchors) {
            if (anchor instanceof ChopboxAnchor) {
              sourceAnchor = anchor;
             
              break;
            }
          }
        }
       
        if (baseElement.getId().equals(association.getTargetRef())) {
          final List<Anchor> anchors = ((ContainerShape) shape).getAnchors();
          for (final Anchor anchor : anchors) {
            if (anchor instanceof ChopboxAnchor) {
              targetAnchor = anchor;
             
              break;
            }
          }
        }
      }
    }
   
    if (sourceAnchor == null || targetAnchor == null) {
      return null;
    }
   
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
   
    // CONNECTION WITH POLYLINE
    final FreeFormConnection connection = peCreateService.createFreeFormConnection(getDiagram());
   
    connection.setStart(sourceAnchor);
    connection.setEnd(targetAnchor);
   
    sourceAnchor.getOutgoingConnections().add(connection);
    targetAnchor.getIncomingConnections().add(connection);
   
    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
   
    BaseElement sourceElement = model.getFlowElement(association.getSourceRef());
    if (sourceElement == null) {
      sourceElement = model.getArtifact(association.getSourceRef());
    }
    BaseElement targetElement = model.getFlowElement(association.getTargetRef());
    if (targetElement == null) {
      targetElement = model.getArtifact(association.getTargetRef());
    }

    final GraphicsAlgorithm sourceGraphics = getPictogramElement(sourceElement).getGraphicsAlgorithm();
    GraphicsAlgorithm targetGraphics = getPictogramElement(targetElement).getGraphicsAlgorithm();
   
View Full Code Here

    for (Artifact artifact : artifactList) {

      if (artifact instanceof Association == false) {
        continue;
      } else {
        Association association = (Association) artifact;
        drawAssociation(association, model);
      }
    }
  }
View Full Code Here

TOP

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

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.