예제 #1
0
  protected void searchSubProcess(SubProcess sub) {
    StringBuilder temp = new StringBuilder();

    int num = 0;
    for (FlowElement fe : sub.getFlowElements()) {
      if (fe instanceof SubProcess) {
        SubProcess ssub = (SubProcess) fe;
        // System.out.format("Found a SubProcess: %s\n", ssub.getName());
        this.searchSubProcess(ssub);
      } else if (fe instanceof IntermediateCatchEvent) {

        IntermediateCatchEvent a = (IntermediateCatchEvent) fe;
        if (a.getName() == null || (a.getName().length() == 0)) {
          // System.out.println(fe.eClass().getName() + ": name="+ fe.getName()!=null? fe.getName()
          // : "Unlabeled" + " ID=" + fe.getId());
          num++;

          elementsBPMN.add(fe);
          String name =
              fe.getName() != null
                  ? fe.getName()
                  : Messages.getString("Generic.LabelEmpty", l); // $NON-NLS-1$
          setElements(fe.getId(), IDProcess, name);
          temp.append(
              "* name="
                  + name
                  + " ID="
                  + fe.getId() // $NON-NLS-1$ //$NON-NLS-2$
                  + "\n"); //$NON-NLS-1$
        }

      } else if (fe instanceof IntermediateThrowEvent) {
        IntermediateThrowEvent a = (IntermediateThrowEvent) fe;
        if (a.getName() == null || (a.getName().length() == 0)) {
          num++;

          elementsBPMN.add(fe);
          String name =
              fe.getName() != null
                  ? fe.getName()
                  : Messages.getString("Generic.LabelEmpty", l); // $NON-NLS-1$
          setElements(fe.getId(), IDProcess, name);
          temp.append(
              "* name="
                  + name
                  + " ID="
                  + fe.getId() // $NON-NLS-1$ //$NON-NLS-2$
                  + "\n"); //$NON-NLS-1$
        }
      }
    }
    if (num > 0) {
      this.Suggestion +=
          Messages.getString("LabelingEvents.SuggestionSubProcessKO", l)
              + sub.getName()
              + " "; //$NON-NLS-1$ //$NON-NLS-2$
      this.status = false;
    }
  }
예제 #2
0
  public static void updateCategoryValues(IFeatureProvider fp, PictogramElement pe) {

    Resource resource = ObjectPropertyProvider.getResource(pe);
    if (Bpmn2Preferences.getInstance(resource).getPropagateGroupCategories()) {
      // only do this if User Preference is enabled: assign the Group's CategoryValue
      // to the FlowElement represented by the given PictogramElement
      Diagram diagram = fp.getDiagramTypeProvider().getDiagram();
      FlowElement flowElement = BusinessObjectUtil.getFirstElementOfType(pe, FlowElement.class);
      if (flowElement == null) return;
      // remove any previous Category Values from this FlowElement
      flowElement.getCategoryValueRef().clear();

      // find all Groups in this Resource and check if it contains the given FlowElement
      if (pe instanceof ContainerShape) {
        for (Group group : ModelUtil.getAllObjectsOfType(resource, Group.class)) {
          CategoryValue cv = group.getCategoryValueRef();
          if (cv == null) continue;

          for (PictogramElement groupShape :
              Graphiti.getLinkService().getPictogramElements(diagram, group)) {
            if (groupShape instanceof ContainerShape) {
              for (ContainerShape flowElementShape :
                  FeatureSupport.findGroupedShapes((ContainerShape) groupShape)) {
                FlowElement fe =
                    BusinessObjectUtil.getFirstElementOfType(flowElementShape, FlowElement.class);
                if (fe == flowElement) {
                  fe.getCategoryValueRef().add(cv);
                  break;
                }
              }
            }
          }
        }
      } else if (pe instanceof Connection && flowElement instanceof SequenceFlow) {
        SequenceFlow sf = (SequenceFlow) flowElement;
        FlowNode source = sf.getSourceRef();
        FlowNode target = sf.getTargetRef();

        sf.getCategoryValueRef().clear();
        sf.getCategoryValueRef().addAll(source.getCategoryValueRef());
        sf.getCategoryValueRef().addAll(target.getCategoryValueRef());
      }
    }
  }
예제 #3
0
  @Override
  protected void findGL(Definitions diagram) {
    StringBuilder temp = new StringBuilder();

    int num = 0;

    for (RootElement rootElement : diagram.getRootElements()) {
      if (rootElement instanceof Process) {
        Process process = (Process) rootElement;
        // System.out.format("Found a process: %s\n", process.getName());

        IDProcess = process.getId();
        for (FlowElement fe : process.getFlowElements()) {
          if (fe instanceof SubProcess) {
            SubProcess sub = (SubProcess) fe;
            // System.out.format("Found a SubProcess: %s\n", sub.getName());
            this.searchSubProcess(sub);
          } else if (fe instanceof IntermediateCatchEvent) {
            IntermediateCatchEvent a = (IntermediateCatchEvent) fe;
            if (a.getName() == null || (a.getName().length() == 0)) {
              num++;

              elementsBPMN.add(fe);
              String name =
                  fe.getName() != null
                      ? fe.getName()
                      : Messages.getString("Generic.LabelEmpty", l); // $NON-NLS-1$
              setElements(fe.getId(), IDProcess, name);
              temp.append(
                  "* name="
                      + name
                      + " ID="
                      + fe.getId() // $NON-NLS-1$ //$NON-NLS-2$
                      + "\n"); //$NON-NLS-1$
            }

          } else if (fe instanceof IntermediateThrowEvent) {
            IntermediateThrowEvent a = (IntermediateThrowEvent) fe;
            if (a.getName() == null || (a.getName().length() == 0)) {
              num++;

              elementsBPMN.add(fe);
              String name =
                  fe.getName() != null
                      ? fe.getName()
                      : Messages.getString("Generic.LabelEmpty", l); // $NON-NLS-1$
              setElements(fe.getId(), IDProcess, name);
              temp.append(
                  "* name="
                      + name
                      + " ID="
                      + fe.getId() // $NON-NLS-1$ //$NON-NLS-2$
                      + "\n"); //$NON-NLS-1$
            }
          }
        }
      }
    }
    if (num > 0) {

      this.Suggestion += Messages.getString("LabelingEvents.SuggestionKO", l); // $NON-NLS-1$
      this.status = false;
    } else {
      this.status = true;
      this.Suggestion += Messages.getString("LabelingEvents.SuggestionOK", l); // $NON-NLS-1$
    }
  }