コード例 #1
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;
  }
コード例 #2
0
 private String tooManyMessagesTextID() {
   if (messageEvent.isIntermediateEvent()) {
     if (messageEvent.isCatching()) {
       return "multipleIncomingMessageFlowsToIntermediateEvent";
     } else {
       return "multipleOutgoingMessageFlowsFromIntermediateEvent";
     }
   } else if (messageEvent.isStartEvent()) {
     return "multipleIncomingMessageFlowsToMessageStartEvent";
   } else {
     return "multipleOutgoingMessageFlowsFromMessageEndEvent";
   }
 }
コード例 #3
0
 private String noMessagesTextID() {
   if (messageEvent.isIntermediateEvent()) {
     if (messageEvent.isCatching()) {
       return "messageIntermediateCatchEventWithoutMessageFlow";
     } else {
       return "messageIntermediateThrowEventWithoutMessageFlow";
     }
   } else if (messageEvent.isStartEvent()) {
     return "messageStartEventWithoutMessageFlow";
   } else {
     return "messageEndEventWithoutMessageFlow";
   }
 }
コード例 #4
0
 private List<EdgeAdaptor> getMessageFlowList() {
   if (messageEvent.isThrowingMessageEvent()) {
     return model.getOutgoingEdges(MessageFlow.class, messageEvent);
   } else {
     return model.getIncomingEdges(MessageFlow.class, messageEvent);
   }
 }
コード例 #5
0
 public void doValidation() {
   if (!model.isColaboration()) return;
   List<EdgeAdaptor> messages = getMessageFlowList();
   List<EdgeAdaptor> conversationLinks = messageEvent.getAdjacentEdges(ConversationLink.class);
   if (messages.isEmpty() && conversationLinks.isEmpty()) {
     reportNoMessages(); // @todo: Validation needs to be refined for main process events!
   } else if (messages.size() + conversationLinks.size() > 1) {
     reportTooManyMessages(messages);
   }
 }