コード例 #1
0
ファイル: Mapping.java プロジェクト: bptlab/processeditor
 private Node mapProcessNode(NodeAdaptor node) {
   if (node.getContainingProcess().isSubProcess()) {
     return null;
   } else {
     return this.graph.createNode(node.getText());
   }
 }
コード例 #2
0
ファイル: Mapping.java プロジェクト: bptlab/processeditor
  private Map<NodeAdaptor, Node> createNodeMapping() {
    Map<NodeAdaptor, Node> nodeMap = new HashMap<NodeAdaptor, Node>();

    for (NodeAdaptor node : this.nodes) {
      Node graphNode = null;

      if (nodeMap.containsKey(node)) {
        continue;
      }

      if (node.isActivity()
          || node.isStartEvent()
          || node.isEndEvent()
          || node.isGateway()
          || node.isChoreographyActivity()) {

        graphNode = mapProcessNode(node);
      } else if (node.isEvent()) { // IntermediateEvent
        EventAdaptor event = (EventAdaptor) node;
        // map attached event to parent if a parent exists
        if (event.isAttached()) {
          NodeAdaptor parentNode = event.getParentNode();
          //                    System.out.println("found attached");
          if (!nodeMap.containsKey(parentNode)) {
            graphNode = this.mapProcessNode(parentNode);
            if (graphNode != null) {
              nodeMap.put(parentNode, graphNode);
            }
          } else {
            graphNode = nodeMap.get(parentNode);
          }
        } else {
          graphNode = mapProcessNode(node);
        }
      }

      // ignore all other elements

      if (graphNode != null) {
        nodeMap.put(node, graphNode);

        if (node.isStartEvent()) {
          this.graph.addSource(graphNode);
        }

        if (node.isEndEvent()) {
          this.graph.addSink(graphNode);
        }
      }
    }

    return nodeMap;
  }
コード例 #3
0
 private NodeAdaptor getEndEvent() {
   for (ProcessNode node : workbench.getSelectedModel().getNodes()) {
     if (workbench.getSelectedModel().getOutgoingEdges(SequenceFlow.class, node).isEmpty()) {
       return NodeAdaptor.adapt(node, new ModelAdaptor((BPMNModel) workbench.getSelectedModel()));
     }
   }
   return null;
 }
コード例 #4
0
 private NodeAdaptor getStartEvent() {
   for (ProcessNode node : workbench.getSelectedModel().getNodes()) {
     if (
     /*workbench.getSelectedModel().
     getIncomingEdges(SequenceFlow.class, node).isEmpty()*/
     node instanceof StartEvent) {
       return NodeAdaptor.adapt(node, new ModelAdaptor((BPMNModel) workbench.getSelectedModel()));
     }
   }
   return null;
 }