Esempio n. 1
0
 public Vector<AbstractNode> nodesWithSameName() {
   Vector<AbstractNode> returned = new Vector<AbstractNode>();
   Vector<AbstractNode> allNodes = getProcess().getAllAbstractNodes();
   for (Enumeration<AbstractNode> e = allNodes.elements(); e.hasMoreElements(); ) {
     AbstractNode node = e.nextElement();
     if ((node != this)
         && (node.getFullyQualifiedName().equalsIgnoreCase(getFullyQualifiedName()))) {
       returned.add(node);
     }
   }
   return returned;
 }
Esempio n. 2
0
 @Override
 public ValidationIssue<NodeWithDefaultFlowMustHaveConditionOneOtherEdge, AbstractNode>
     applyValidation(final AbstractNode node) {
   int defaultCount = 0;
   int conditionalCount = 0;
   int totalCount = 0;
   for (FlexoPostCondition p : node.getOutgoingPostConditions()) {
     if (p instanceof TokenEdge) {
       totalCount++;
       if (p.getIsDefaultFlow()) {
         defaultCount++;
       } else if (p.getIsConditional()) {
         conditionalCount++;
       }
     }
   }
   if (defaultCount > 0 && totalCount != defaultCount + conditionalCount) {
     if (node instanceof OperatorNode && ((OperatorNode) node).isExclusiveGateway()) {
       return null; // There is a rule on the post conditions to prevent this already!
     } else {
       ValidationWarning<NodeWithDefaultFlowMustHaveConditionOneOtherEdge, AbstractNode>
           warning =
               new ValidationWarning<
                   NodeWithDefaultFlowMustHaveConditionOneOtherEdge, AbstractNode>(
                   this,
                   node,
                   "node_($object.name)_has_one_default_outgoing_flow_and_so_other_edges_must_be_conditionnal");
       return warning;
     }
   }
   return null;
 }
Esempio n. 3
0
 public RenameThisNode(AbstractNode node) {
   super(
       "rename_this_node",
       "newName",
       "enter_a_non_ambigous_name",
       node.findNextNonAmbigousName());
 }
Esempio n. 4
0
 @Override
 public ValidationIssue<NodeShouldHaveNonAmbigousName, AbstractNode> applyValidation(
     final AbstractNode node) {
   Vector<? extends Validable> nodesWithSameName = node.nodesWithSameName();
   if (nodesWithSameName.size() > 0) {
     ValidationWarning<NodeShouldHaveNonAmbigousName, AbstractNode> warning =
         new ValidationWarning<NodeShouldHaveNonAmbigousName, AbstractNode>(
             this, node, "node_($object.name)_has_ambigous_name");
     warning.addToRelatedValidableObjects(nodesWithSameName);
     warning.addToFixProposals(new RenameThisNode(node));
     return warning;
   }
   if (node.getProcess() != null
       && node.getProcess().getName().equalsIgnoreCase(node.getName())) {
     ValidationWarning<NodeShouldHaveNonAmbigousName, AbstractNode> warning =
         new ValidationWarning<NodeShouldHaveNonAmbigousName, AbstractNode>(
             this, node, "node_($object.name)_has_ambigous_name");
     warning.addToRelatedValidableObjects(node.getProcess());
     warning.addToFixProposals(new RenameThisNode(node));
     return warning;
   }
   return null;
 }
Esempio n. 5
0
 @Override
 public ValidationIssue<NodeCannotHaveMoreThanOneDefaultOutgoingTokenEdge, AbstractNode>
     applyValidation(final AbstractNode node) {
   boolean hasAlreadyOne = false;
   for (FlexoPostCondition p : node.getOutgoingPostConditions()) {
     if (p instanceof TokenEdge && p.getIsDefaultFlow()) {
       if (hasAlreadyOne) {
         ValidationWarning<NodeCannotHaveMoreThanOneDefaultOutgoingTokenEdge, AbstractNode>
             warning =
                 new ValidationWarning<
                     NodeCannotHaveMoreThanOneDefaultOutgoingTokenEdge, AbstractNode>(
                     this, node, "node_($object.name)_has_more_than_one_default_outgoing_edge");
         return warning;
       } else {
         hasAlreadyOne = true;
       }
     }
   }
   return null;
 }
Esempio n. 6
0
    @Override
    public ValidationIssue<
            NodeWithConditionalEdgeOrDefaultEdgeMustHaveMoreThanOneEdge, AbstractNode>
        applyValidation(final AbstractNode node) {
      int defaultCount = 0;
      int conditionalCount = 0;
      int regular = 0;
      Vector<FlexoPostCondition<?, ?>> listOfAllPostToConsider =
          new Vector<FlexoPostCondition<?, ?>>();
      listOfAllPostToConsider.addAll(node.getOutgoingPostConditions());

      if ((node instanceof ActivityNode || node instanceof OperationNode)) {
        FlexoNode startNode = (FlexoNode) node;
        if (startNode.isEndNode()) {
          // try to find other brother end node with outgoing post
          for (PetriGraphNode brotherNode : startNode.getParentPetriGraph().getNodes()) {
            if (brotherNode instanceof FlexoNode) {
              if (((FlexoNode) brotherNode).isEndNode() && brotherNode != startNode) {
                return null;
              }
            }
          }
          if (startNode.getParentPetriGraph().getContainer() instanceof SubProcessNode) {
            SubProcessNode sub = (SubProcessNode) startNode.getParentPetriGraph().getContainer();
            if (sub.getPortMapRegistery().getAllOutPortmaps().size() > 0) {
              return null;
            }
          }
        }
      } else if (node instanceof FlexoPortMap && ((FlexoPortMap) node).isOutputPort()) {
        SubProcessNode sub = ((FlexoPortMap) node).getSubProcessNode();
        if (sub.getPortMapRegistery().getAllOutPortmaps().size() > 0) {
          return null;
        }
        if (sub.getOperationPetriGraph() != null
            && sub.getOperationPetriGraph().getAllEndNodes().size() > 0) {
          return null;
        }
      }

      for (FlexoPostCondition p : listOfAllPostToConsider) {
        if (p.getIsDefaultFlow()) {
          defaultCount++;
        } else if (p.getIsConditional()) {
          conditionalCount++;
        } else {
          regular++;
        }
      }
      if (defaultCount > 0 && (regular + conditionalCount) == 0) {
        if (node instanceof OperatorNode && ((OperatorNode) node).isExclusiveGateway()) {
          return null; // There is a rule on the post conditions to prevent this already!
        } else {
          ValidationWarning<
                  NodeWithConditionalEdgeOrDefaultEdgeMustHaveMoreThanOneEdge, AbstractNode>
              warning =
                  new ValidationWarning<
                      NodeWithConditionalEdgeOrDefaultEdgeMustHaveMoreThanOneEdge, AbstractNode>(
                      this,
                      node,
                      "node_($object.name)_has_one_default_outgoing_edge_should_have_at_least_another_outgoing_edge");
          return warning;
        }
      }
      if (conditionalCount == 1
          && regular == 0
          && defaultCount == 0
          && !listOfAllPostToConsider.firstElement().mustBeConditional()) {
        if (node instanceof OperatorNode && ((OperatorNode) node).isExclusiveGateway()) {
          return null; // There is a rule on the post conditions to prevent this already!
        } else {
          ValidationWarning<
                  NodeWithConditionalEdgeOrDefaultEdgeMustHaveMoreThanOneEdge, AbstractNode>
              warning =
                  new ValidationWarning<
                      NodeWithConditionalEdgeOrDefaultEdgeMustHaveMoreThanOneEdge, AbstractNode>(
                      this,
                      node,
                      "node_($object.name)_has_one_conditional_outgoing_edge_should_have_at_least_another_outgoing_edge");
          return warning;
        }
      }
      return null;
    }