Package org.jbpm.workflow.core.node

Examples of org.jbpm.workflow.core.node.Join


                                "Split node '" + node.getName() + "' [" + node.getId() + "] does not have a constraint for " + connection.toString() + "."));
                        }
                    }
                }
            } else if (node instanceof Join) {
                final Join join = (Join) node;
                if (join.getType() == Join.TYPE_UNDEFINED) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "Join node '" + node.getName() + "' [" + node.getId() + "] has no type."));
                }
                if (join.getDefaultIncomingConnections().size() < 2) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "Join node '" + node.getName() + "' [" + node.getId() + "] does not have more than one incoming connection: " + join.getIncomingConnections().size() + "."));
                }
                if (join.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "Join node '" + node.getName() + "' [" + node.getId() + "] has no outgoing connection."));
                }
                if (join.getType() == Join.TYPE_N_OF_M) {
                  String n = join.getN();
                  if (!n.startsWith("#{") || !n.endsWith("}")) {
                    try {
                      new Integer(n);
                    } catch (NumberFormatException e) {
                            errors.add(new ProcessValidationErrorImpl(process,
View Full Code Here


    public void internalTrigger(final NodeInstance from, String type) {
        if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
            throw new IllegalArgumentException(
                "An ActionNode only accepts default incoming connections!");
        }
        final Join join = getJoin();
        switch ( join.getType() ) {
            case Join.TYPE_XOR :
                triggerCompleted();
                break;
            case Join.TYPE_AND :
                Integer count = (Integer) this.triggers.get( from.getNodeId() );
                if ( count == null ) {
                    this.triggers.put( from.getNodeId(),
                                       1 );
                } else {
                    this.triggers.put( from.getNodeId(),
                                       count.intValue() + 1 );
                }
                if (checkAllActivated()) {
                    decreaseAllTriggers();
                    triggerCompleted();
                }
                break;
            case Join.TYPE_DISCRIMINATOR :
                boolean triggerCompleted = triggers.isEmpty();
                triggers.put( from.getNodeId(), new Integer( 1 ) );
                if (checkAllActivated()) {
                    resetAllTriggers();
                }
                if (triggerCompleted) {
                    triggerCompleted();
                }
                break;
            case Join.TYPE_N_OF_M :
                count = (Integer) this.triggers.get( from.getNodeId() );
                if ( count == null ) {
                    this.triggers.put( from.getNodeId(),
                                       1 );
                } else {
                    this.triggers.put( from.getNodeId(),
                                       count.intValue() + 1 );
                }
                int counter = 0;
                for (final Connection connection: getJoin().getDefaultIncomingConnections()) {
                    if ( this.triggers.get( connection.getFrom().getId() ) != null ) {
                        counter++;
                    }
                }
                String n = join.getN();
                Integer number = null;
                if (n.startsWith("#{") && n.endsWith("}")) {
                  n = n.substring(2, n.length() - 1);
                  VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                    resolveContextInstance(VariableScope.VARIABLE_SCOPE, n);
                  if (variableScopeInstance == null) {
                    throw new IllegalArgumentException(
                    "Could not find variable " + n + " when executing join.");
                  }
                  Object value = variableScopeInstance.getVariable(n);
                  if (value instanceof Number) {
                    number = ((Number) value).intValue();
                  } else {
                    throw new IllegalArgumentException(
                    "Variable " + n + " did not return a number when executing join: " + value);
                  }
                } else {
                number = new Integer(n);
                }
                if (counter >= number) {
                    resetAllTriggers();
                    triggerCompleted();
                }
                break;
            default :
                throw new IllegalArgumentException( "Illegal join type " + join.getType() );
        }
    }
View Full Code Here

        new ConnectionImpl(
            eventNode, Node.CONNECTION_DEFAULT_TYPE,
            actionNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        Join join = new Join();
        join.setName("XOR Join");
        join.setType(Join.TYPE_XOR);
        join.setId(5);
        process.addNode(join);
        new ConnectionImpl(
            milestoneNode, Node.CONNECTION_DEFAULT_TYPE,
            join, Node.CONNECTION_DEFAULT_TYPE
        );
View Full Code Here

        new ConnectionImpl(
            eventNode2, Node.CONNECTION_DEFAULT_TYPE,
            actionNode2, Node.CONNECTION_DEFAULT_TYPE
        );
       
        Join join = new Join();
        join.setName("AND Join");
        join.setType(Join.TYPE_AND);
        join.setId(7);
        process.addNode(join);
        new ConnectionImpl(
            startNode, Node.CONNECTION_DEFAULT_TYPE,
            join, Node.CONNECTION_DEFAULT_TYPE
        );
View Full Code Here

        new ConnectionImpl(
            eventNode2, Node.CONNECTION_DEFAULT_TYPE,
            actionNode2, Node.CONNECTION_DEFAULT_TYPE
        );
       
        Join join = new Join();
        join.setName("AND Join");
        join.setType(Join.TYPE_AND);
        join.setId(7);
        process.addNode(join);
        new ConnectionImpl(
            startNode, Node.CONNECTION_DEFAULT_TYPE,
            join, Node.CONNECTION_DEFAULT_TYPE
        );
View Full Code Here

        new ConnectionImpl(
            eventNode, Node.CONNECTION_DEFAULT_TYPE,
            actionNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        Join join = new Join();
        join.setName("XOR Join");
        join.setType(Join.TYPE_XOR);
        compositeNode.addNode(join);
        new ConnectionImpl(
            milestoneNode, Node.CONNECTION_DEFAULT_TYPE,
            join, Node.CONNECTION_DEFAULT_TYPE
        );
        new ConnectionImpl(
            actionNode, Node.CONNECTION_DEFAULT_TYPE,
            join, Node.CONNECTION_DEFAULT_TYPE
        );
        compositeNode.linkOutgoingConnections(join.getId(), Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE);
   
        EndNode endNode = new EndNode();
        endNode.setName("EndNode");
        endNode.setId(3);
        process.addNode(endNode);
View Full Code Here

    public static final String TYPE = "type";
    public static final String N = "N";
   
    public JoinWrapper() {
        setNode(new Join());
        getJoin().setName("Join");
        setDescriptors();
    }
View Full Code Here

        testCode +=
          "        // handle fault " + faultNode.getFaultName() + " if necessary\n";
        return true;
      } else if (currentNode instanceof Join) {
        // TODO looping
        Join join = (Join) currentNode;
        switch (join.getType()) {
        case Join.TYPE_AND:
          // TODO: cannot just call processNodes as this will add it to the cases if an end is reached,
          // while it should also still include the work that is necessary to complete the other branches         
            // processNodes(name, ((NodeImpl) currentNode).getTo().getTo(), testCode, cases, ongoingCases);
            // TODO: this isn't 100% correct, as a join should only wait for the other incoming connections,
            // not all other non-terminating connections, but not doing this would make test ignore the other
            // branches of the divering parallel gateway
            // return false;
          throw new IllegalArgumentException("Generation of tests that include a convering parallel gateway is not yet supported");
        case Join.TYPE_XOR:
            return processNodes(name, ((NodeImpl) currentNode).getTo().getTo(), testCode, cases, ongoingCases);
        default:
          throw new IllegalArgumentException("Unknown join type " + join.getType());
      }
      } else if (currentNode instanceof NodeImpl) {
        return processNodes(name, ((NodeImpl) currentNode).getTo().getTo(), testCode, cases, ongoingCases);
      } else {
        throw new IllegalArgumentException("Unknown node " + currentNode);
View Full Code Here

    public static final String TYPE = "type";
    public static final String N = "N";
   
    public JoinWrapper() {
        setNode(new Join());
        getJoin().setName("Join");
    }
View Full Code Here

    private Map<Long, Integer> triggers = new HashMap<Long, Integer>();

    @Override
    public void internalTrigger(NodeInstance from, String type) {

        Join joinNode = (Join) getNode();

        SimulationContext context = SimulationContext.getContext();

        ActivitySimulator simulator = context.getRegistry().getSimulator(getNode());
        SimulationEvent event = simulator.simulate(this, context);

        context.getRepository().storeEvent(event);
        long thisNodeCurrentTime = context.getClock().getCurrentTime();
        boolean processOutgoing = true;
        if (joinNode.getType() == Join.TYPE_AND) {
            processOutgoing = false;
            Integer count = (Integer) this.triggers.get( from.getNodeId() );
            if ( count == null ) {
                this.triggers.put( from.getNodeId(),
                        1 );
View Full Code Here

TOP

Related Classes of org.jbpm.workflow.core.node.Join

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.