Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.BaseElement


        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);
View Full Code Here


    boolean async = parseAsync(xtr);
    boolean notExclusive = parseNotExclusive(xtr);
    String defaultFlow = xtr.getAttributeValue(null, ATTRIBUTE_DEFAULT);
    boolean isForCompensation = parseForCompensation(xtr);
   
    BaseElement parsedElement = convertXMLToElement(xtr, model);
   
    if (parsedElement instanceof Artifact) {
      Artifact currentArtifact = (Artifact) parsedElement;
      currentArtifact.setId(elementId);
View Full Code Here

* @author Tijs Rademakers
*/
public class ExtensionElementsParser implements BpmnXMLConstants {
 
  public void parse(XMLStreamReader xtr, List<SubProcess> activeSubProcessList, Process activeProcess, BpmnModel model) throws Exception {
    BaseElement parentElement = null;
    if (!activeSubProcessList.isEmpty()) {
      parentElement = activeSubProcessList.get(activeSubProcessList.size() - 1);
     
    } else {
      parentElement = activeProcess;
    }
   
    boolean readyWithChildElements = false;
    while (readyWithChildElements == false && xtr.hasNext()) {
      xtr.next();
      if (xtr.isStartElement()) {
        if (ELEMENT_EXECUTION_LISTENER.equals(xtr.getLocalName())) {
          new ExecutionListenerParser().parseChildElement(xtr, parentElement, model);
        } else if (ELEMENT_EVENT_LISTENER.equals(xtr.getLocalName())){
          new ActivitiEventListenerParser().parseChildElement(xtr, parentElement, model);
        } else if (ELEMENT_POTENTIAL_STARTER.equals(xtr.getLocalName())){
          new PotentialStarterParser().parse(xtr, activeProcess);
        } else {
          ExtensionElement extensionElement = BpmnXMLUtil.parseExtensionElement(xtr);
          parentElement.addExtensionElement(extensionElement);
        }

      } else if (xtr.isEndElement()) {
        if (ELEMENT_EXTENSIONS.equals(xtr.getLocalName())) {
          readyWithChildElements = true;
View Full Code Here

        } else if (ELEMENT_LANE.equals(xtr.getLocalName())) {
          laneParser.parse(xtr, activeProcess, model);
         
        } else if (ELEMENT_DOCUMENTATION.equals(xtr.getLocalName())) {
         
          BaseElement parentElement = null;
          if (!activeSubProcessList.isEmpty()) {
            parentElement = activeSubProcessList.get(activeSubProcessList.size() - 1);
          } else if (activeProcess != null) {
            parentElement = activeProcess;
          }
View Full Code Here

    super(fp, "Association", "Associate information with artifacts and flow objects");
  }

  @Override
  public boolean canCreate(ICreateConnectionContext context) {
    final BaseElement sourceBo = getBaseElement(context.getSourceAnchor());
    final BaseElement targetBo = getBaseElement(context.getTargetAnchor());
   
    boolean canCreate = false;
   
    if (sourceBo != targetBo && (sourceBo instanceof TextAnnotation || targetBo instanceof TextAnnotation)) {
      canCreate = true;
View Full Code Here

  @Override
  public Connection create(ICreateConnectionContext context) {
    final Anchor sourceAnchor = context.getSourceAnchor();
    final Anchor targetAnchor = context.getTargetAnchor();
   
    final BaseElement sourceBo = getBaseElement(sourceAnchor)
    final BaseElement targetBo = getBaseElement(targetAnchor);
   
    if (sourceBo == null || targetBo == null) {
      return null;
    } else {
      // create new association
View Full Code Here

 
  protected void updateAssociation(Association association) {
    Shape sourceShape = null;
    Shape targetShape = null;
    if(StringUtils.isNotEmpty(association.getSourceRef())) {
      BaseElement sourceElement = model.getFlowElement(association.getSourceRef());
      if (sourceElement == null) {
        sourceElement = model.getArtifact(association.getSourceRef());
      }
      sourceShape = (Shape) featureProvider.getPictogramElementForBusinessObject(sourceElement);
    }
    if(StringUtils.isNotEmpty(association.getTargetRef())) {
      BaseElement targetElement = model.getFlowElement(association.getTargetRef());
      if (targetElement == null) {
        targetElement = model.getArtifact(association.getTargetRef());
      }
      targetShape = (Shape) featureProvider.getPictogramElementForBusinessObject(targetElement);
    }
View Full Code Here

          }
         
         
        } else if (ELEMENT_DOCUMENTATION.equalsIgnoreCase(xtr.getLocalName())) {
         
          BaseElement parentElement = null;
          if(activeSubProcessList.size() > 0) {
            parentElement = activeSubProcessList.get(activeSubProcessList.size() - 1);
          } else if(activeProcess != null) {
            parentElement = activeProcess;
          }
View Full Code Here

   
    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();
View Full Code Here

  private void drawAssociation(Association association, Bpmn2MemoryModel model) {

    Anchor sourceAnchor = null;
    Anchor targetAnchor = null;
    BaseElement sourceElement = model.getFlowElement(association.getSourceRef());
    if (sourceElement == null) {
      sourceElement = model.getArtifact(association.getSourceRef());
    }
    if (sourceElement == null) {
      return;
    }
    ContainerShape sourceShape = (ContainerShape) getDiagramTypeProvider().getFeatureProvider()
            .getPictogramElementForBusinessObject(sourceElement);

    if (sourceShape == null) {
      return;
    }

    EList<Anchor> anchorList = sourceShape.getAnchors();
    for (Anchor anchor : anchorList) {
      if (anchor instanceof ChopboxAnchor) {
        sourceAnchor = anchor;
        break;
      }
    }

    BaseElement targetElement = model.getFlowElement(association.getTargetRef());
    if (targetElement == null) {
      targetElement = model.getArtifact(association.getTargetRef());
    }
    if (targetElement == null) {
      return;
View Full Code Here

TOP

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

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.