Package org.eclipse.bpmn2

Examples of org.eclipse.bpmn2.ChoreographyActivity


    public void testIntermediateCatchCompensationEventUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("intermediateCatchCompensationEvent.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        CatchEvent g = (CatchEvent) process.getFlowElements().get(0);
        assertEquals("catch compensation event", g.getName());
        assertTrue(g.getEventDefinitions().iterator().next() instanceof CompensateEventDefinition);
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here


    public void testIntermediateCatchMultipleEventUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("intermediateCatchMultipleEvent.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        CatchEvent g = (CatchEvent) process.getFlowElements().get(0);
        assertEquals("catch multiple event", g.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    public void testIntermediateCatchParallelMultipleEventUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("intermediateCatchParallelMultipleEvent.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        CatchEvent g = (CatchEvent) process.getFlowElements().get(0);
        assertEquals("catch parallel multiple event", g.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case Bpmn2Package.CHOREOGRAPHY_ACTIVITY: {
            ChoreographyActivity choreographyActivity = (ChoreographyActivity) theEObject;
            T result = caseChoreographyActivity(choreographyActivity);
            if (result == null)
                result = caseFlowNode(choreographyActivity);
            if (result == null)
                result = caseFlowElement(choreographyActivity);
View Full Code Here

  public static void updateParticipantReferences(ContainerShape choreographyContainer,
      List<ContainerShape> currentParticipantContainers, List<Participant> newParticipants, IFeatureProvider fp,
      boolean showNames) {

    Diagram diagram = peService.getDiagramForShape(choreographyContainer);
    ChoreographyActivity choreography = BusinessObjectUtil.getFirstElementOfType(choreographyContainer,
        ChoreographyActivity.class);

    BPMNDiagram dia = BusinessObjectUtil.getFirstElementOfType(diagram, BPMNDiagram.class);
    List<DiagramElement> diElements = dia.getPlane().getPlaneElement();
    for (int i = 0; i < currentParticipantContainers.size(); i++) {
View Full Code Here

  }

  @Override
  public IReason updateNeeded(IUpdateContext context) {
    ContainerShape choreographyContainer = (ContainerShape) context.getPictogramElement();
    ChoreographyActivity choreography = BusinessObjectUtil.getFirstElementOfType(choreographyContainer,
        ChoreographyActivity.class);

    String loopType = choreography.getLoopType() == null ? "null" : choreography.getLoopType().getName();
    String property = peService.getPropertyValue(choreographyContainer, ChoreographyProperties.CHOREOGRAPHY_MARKER);

    if (!loopType.equals(property)) {
      return Reason.createTrueReason();
    } else {
View Full Code Here

  }

  @Override
  public boolean update(IUpdateContext context) {
    ContainerShape choreographyContainer = (ContainerShape) context.getPictogramElement();
    ChoreographyActivity choreography = BusinessObjectUtil.getFirstElementOfType(choreographyContainer,
        ChoreographyActivity.class);

    for (Shape s : peService.getAllContainedShapes(choreographyContainer)) {
      String property = peService.getPropertyValue(s, ChoreographyProperties.CHOREOGRAPHY_MARKER_SHAPE);
      if (property != null && new Boolean(property)) {
        ChoreographyUtil.drawChoreographyLoopType((ContainerShape) s, choreography.getLoopType());
      }
    }

    String loopType = choreography.getLoopType() == null ? "null" : choreography.getLoopType().getName();
    peService.setPropertyValue(choreographyContainer, ChoreographyProperties.CHOREOGRAPHY_MARKER, loopType);

    return true;
  }
View Full Code Here

  }

  @Override
  public IReason updateNeeded(IUpdateContext context) {

    ChoreographyActivity choreography = BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
        ChoreographyActivity.class);

    String id = peService.getPropertyValue(context.getPictogramElement(), INITIATING_PARTICIPANT_REF);
    Participant participant = choreography.getInitiatingParticipantRef();

    if ((id == null || id.equals("null")) && participant == null) {
      return Reason.createFalseReason();
    }
View Full Code Here

  @Override
  public boolean update(IUpdateContext context) {

    ContainerShape container = (ContainerShape) context.getPictogramElement();

    ChoreographyActivity choreography = BusinessObjectUtil.getFirstElementOfType(container,
        ChoreographyActivity.class);

    boolean hasInitiatingParticipant = choreography.getInitiatingParticipantRef() != null;

    for (ContainerShape band : ChoreographyUtil.getParticipantBandContainerShapes(container)) {
      Participant participant = BusinessObjectUtil.getFirstElementOfType(band, Participant.class);
      boolean isInitiating = hasInitiatingParticipant
          && participant.equals(choreography.getInitiatingParticipantRef());
      Color color = manageColor(isInitiating ? IColorConstant.WHITE : IColorConstant.LIGHT_GRAY);
      band.getGraphicsAlgorithm().setBackground(color);
      BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(band, BPMNShape.class);
      bpmnShape.setParticipantBandKind(getParticipantBandKind(isInitiating, bpmnShape.getParticipantBandKind()));
    }

    Participant initiatingParticipant = choreography.getInitiatingParticipantRef();
    String id = initiatingParticipant == null ? "null" : initiatingParticipant.getId();
    peService.setPropertyValue(context.getPictogramElement(), INITIATING_PARTICIPANT_REF, id);

    return true;
  }
View Full Code Here

    return context.getTargetContainer().equals(getDiagram());
  }

  @Override
  public PictogramElement add(IAddContext context) {
    ChoreographyActivity choreography = (ChoreographyActivity) context.getNewObject();

    int width = context.getWidth() > 0 ? context.getWidth() : 150;
    int height = context.getHeight() > 0 ? context.getHeight() : 150;

    ContainerShape choreographyContainer = peService.createContainerShape(context.getTargetContainer(), true);
    RoundedRectangle containerRect = gaService.createRoundedRectangle(choreographyContainer, R, R);
    gaService.setLocationAndSize(containerRect, context.getX(), context.getY(), width, height);
    StyleUtil.applyBGStyle(containerRect, this);
    decorateContainerRect(containerRect);

    Object importProperty = context.getProperty(DIImport.IMPORT_PROPERTY);
    if (importProperty != null && (Boolean) importProperty) {
      addedFromImport(choreography, choreographyContainer, context);
    }

    Shape nameShape = peService.createShape(choreographyContainer, false);

    Text text = gaService.createDefaultText(getDiagram(), nameShape);
    text.setValue(choreography.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    text.getFont().setBold(false);
    setTextLocation(choreographyContainer, text, width, height);
View Full Code Here

TOP

Related Classes of org.eclipse.bpmn2.ChoreographyActivity

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.