Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.SubProcess


        if(attachedToElement != null) {
          boundaryEvent.setAttachedToRef((Activity) attachedToElement);
          ((Activity) attachedToElement).getBoundaryEvents().add(boundaryEvent);
        }
      } else if(flowElement instanceof SubProcess) {
        SubProcess subProcess = (SubProcess) flowElement;
        processFlowElements(subProcess.getFlowElements(), subProcess);
      }
    }
  }
View Full Code Here


  private void createXML(FlowElement flowElement, BpmnModel model, XMLStreamWriter xtw) throws Exception {
   
    if (flowElement instanceof SubProcess) {
     
      SubProcess subProcess = (SubProcess) flowElement;
      xtw.writeStartElement(ELEMENT_SUBPROCESS);
      xtw.writeAttribute(ATTRIBUTE_ID, subProcess.getId());
      if (StringUtils.isNotEmpty(subProcess.getName())) {
        xtw.writeAttribute(ATTRIBUTE_NAME, subProcess.getName());
      } else {
        xtw.writeAttribute(ATTRIBUTE_NAME, "subProcess");
      }
     
      if (subProcess instanceof EventSubProcess) {
        xtw.writeAttribute(ATTRIBUTE_TRIGGERED_BY, ATTRIBUTE_VALUE_TRUE);
      }
     
      if (StringUtils.isNotEmpty(subProcess.getDocumentation())) {

        xtw.writeStartElement(ELEMENT_DOCUMENTATION);
        xtw.writeCharacters(subProcess.getDocumentation());
        xtw.writeEndElement();
      }
     
      boolean didWriteExtensionStartElement = ActivitiListenerExport.writeListeners(subProcess, false, xtw);
     
      didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(subProcess, didWriteExtensionStartElement, model.getNamespaces(), xtw);
      if (didWriteExtensionStartElement) {
        // closing extensions element
        xtw.writeEndElement();
      }
     
      MultiInstanceExport.writeMultiInstance(subProcess, xtw);
     
      for (FlowElement subElement : subProcess.getFlowElements()) {
        createXML(subElement, model, xtw);
      }
     
      for (Artifact artifact : subProcess.getArtifacts()) {
        createXML(artifact, model, xtw);
      }
     
      xtw.writeEndElement();
     
View Full Code Here

* @author Tijs Rademakers
*/
public class SubProcessParser implements BpmnXMLConstants {
 
  public void parse(XMLStreamReader xtr, List<SubProcess> activeSubProcessList, Process activeProcess) {
    SubProcess subProcess = null;
    if (ELEMENT_TRANSACTION.equalsIgnoreCase(xtr.getLocalName())) {
      subProcess = new Transaction();
    } else if (ATTRIBUTE_VALUE_TRUE.equalsIgnoreCase(xtr.getAttributeValue(null, ATTRIBUTE_TRIGGERED_BY))) {
      subProcess = new EventSubProcess();
    } else {
      subProcess = new SubProcess();
    }
    BpmnXMLUtil.addXMLLocation(subProcess, xtr);
    activeSubProcessList.add(subProcess);
   
    subProcess.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID));
    subProcess.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME));
   
    boolean async = false;
    String asyncString = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_ACTIVITY_ASYNCHRONOUS);
    if (ATTRIBUTE_VALUE_TRUE.equalsIgnoreCase(asyncString)) {
      async = true;
    }
   
    boolean notExclusive = false;
    String exclusiveString = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_ACTIVITY_EXCLUSIVE);
    if (ATTRIBUTE_VALUE_FALSE.equalsIgnoreCase(exclusiveString)) {
      notExclusive = true;
    }

    boolean forCompensation = false;
    String compensationString = xtr.getAttributeValue(null, ATTRIBUTE_ACTIVITY_ISFORCOMPENSATION);
    if (ATTRIBUTE_VALUE_TRUE.equalsIgnoreCase(compensationString)) {
      forCompensation = true;
    }
   
    subProcess.setAsynchronous(async);
    subProcess.setNotExclusive(notExclusive);
    subProcess.setForCompensation(forCompensation);
    if(StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_DEFAULT))) {
      subProcess.setDefaultFlow(xtr.getAttributeValue(null, ATTRIBUTE_DEFAULT));
    }
   
    if(activeSubProcessList.size() > 1) {
      activeSubProcessList.get(activeSubProcessList.size() - 2).addFlowElement(subProcess);
     
View Full Code Here

   
    flowElement = model.getMainProcess().getFlowElement("subprocess1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess1", flowElement.getId());
    SubProcess subProcess = (SubProcess) flowElement;
    assertTrue(subProcess.getFlowElements().size() == 6);
   
    List<ValuedDataObject> dataObjects = ((SubProcess)flowElement).getDataObjects();
    assertTrue(dataObjects.size() == 1);

    ValuedDataObject dataObj = dataObjects.get(0);
View Full Code Here

  }

  @Override
  public void execute(ICustomContext context) {
    try {
      SubProcess subprocess = (SubProcess) ActivitiUiUtil.getBusinessObjectFromContext(context, SubProcess.class);
      this.subprocessId = subprocess.getId();
      this.subprocessName = subprocess.getName();
    } catch (Exception e) {
      e.printStackTrace();
    }
    super.execute(context);
  }
View Full Code Here

    super(fp, "SubProcess", "Add sub process");
  }

  @Override
  public Object[] create(ICreateContext context) {
    SubProcess newSubProcess = new SubProcess();
    addObjectToContainer(context, newSubProcess, "Sub Process");

    // return newly created business object(s)
    return new Object[] { newSubProcess };
  }
View Full Code Here

      elementList = ((SubProcess) parentElement).getFlowElements();
    }
   
    for (FlowElement flowElement : elementList) {
      if(flowElement instanceof SubProcess) {
        SubProcess subProcess = (SubProcess) flowElement;
        subProcess.removeFlowElement(sequenceFlow.getId());
        removeFlow(sequenceFlow, subProcess);
      }
    }
  }
View Full Code Here

      }
    } else {
      final Object parentBo = getBusinessObjectForPictogramElement(parentContainer);
     
      if (parentBo instanceof SubProcess) {
        final SubProcess subProcess = (SubProcess) parentBo;
        subProcess.addArtifact(association);
      } else if (parentBo instanceof Lane) {
        final Lane lane = (Lane) parentBo;
        lane.getParentProcess().addArtifact(association);
      }
    }
View Full Code Here

   
    flowElement = model.getMainProcess().getFlowElement("subprocess");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess", flowElement.getId());
    SubProcess subProcess = (SubProcess) flowElement;
   
    flowElement = subProcess.getFlowElement("receiveTask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ReceiveTask);
    assertEquals("receiveTask", flowElement.getId());
  }
View Full Code Here

  }

  @Override
  public PictogramElement add(IAddContext context) {

    final SubProcess addedSubProcess = (SubProcess) context.getNewObject();
    final ContainerShape parent = context.getTargetContainer();

    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);

    // EList<Property> props = containerShape.getProperties();

    // check whether the context has a size (e.g. from a create feature)
    // otherwise define a default size for the shape
    final int width = context.getWidth() <= 0 ? 205 : context.getWidth();
    final int height = context.getHeight() <= 0 ? 205 : context.getHeight();

    final IGaService gaService = Graphiti.getGaService();
    RoundedRectangle roundedRectangle; // need to access it later
    {
      // create invisible outer rectangle expanded by
      // the width needed for the anchor
      final Rectangle invisibleRectangle = gaService.createInvisibleRectangle(containerShape);
      gaService.setLocationAndSize(invisibleRectangle, context.getX(), context.getY(), width, height);

      // create and set visible rectangle inside invisible rectangle
      roundedRectangle = gaService.createRoundedRectangle(invisibleRectangle, 5, 5);
      roundedRectangle.setParentGraphicsAlgorithm(invisibleRectangle);
      roundedRectangle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      gaService.setLocationAndSize(roundedRectangle, 0, 0, width, height);

      // create link and wire it
      link(containerShape, addedSubProcess);
    }

    // SHAPE WITH TEXT
    {
      // create shape for text
      final Shape shape = peCreateService.createShape(containerShape, false);

      // create and set text graphics algorithm
      final Text text = gaService.createDefaultText(getDiagram(), shape, addedSubProcess.getName());
      text.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
      text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
      Font font = null;
      if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
View Full Code Here

TOP

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

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.