Package org.drools.ruleflow.core

Examples of org.drools.ruleflow.core.Connection


                        ruleSet0,
                        Connection.TYPE_NORMAL );
        new ConnectionImpl( ruleSet0,
                        split,
                        Connection.TYPE_NORMAL );
        Connection out1 = new ConnectionImpl( split,
                        ruleSet1,
                        Connection.TYPE_NORMAL );
        Connection out2 = new ConnectionImpl( split,
                        ruleSet2,
                        Connection.TYPE_NORMAL );
        new ConnectionImpl( ruleSet1,
                        join,
                        Connection.TYPE_NORMAL );
View Full Code Here


                if ( split.getOutgoingConnections().size() < 2 ) {
                    errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.SPLIT_NOT_ENOUGH_OUTGOING_CONNECTIONS, "name = " + split.getName() ) );
                }
                if ( split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR ) {
                    for ( final Iterator it = split.getOutgoingConnections().iterator(); it.hasNext(); ) {
                        final Connection connection = (Connection) it.next();
                        if ( split.getConstraint( connection ) == null ) {
                            errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.SPLIT_OUTGOING_CONNECTION_WITHOUT_CONSTRAINT, "name = " + split.getName() ) );
                        }
                    }
                }
View Full Code Here

        }
        final Boolean prevValue = (Boolean) nodes.put( node,
                                                       Boolean.TRUE );
        if ( prevValue == Boolean.FALSE ) {
            for ( final Iterator it = node.getOutgoingConnections().iterator(); it.hasNext(); ) {
                final Connection connection = (Connection) it.next();
                processNode( connection.getTo(),
                             nodes );
            }
        }
    }
View Full Code Here

    }

    protected void validateAddOutgoingConnection(final Connection connection) {
        super.validateAddOutgoingConnection( connection );
        for ( final Iterator it = getOutgoingConnections().iterator(); it.hasNext(); ) {
            final Connection conn = (Connection) it.next();
            if ( conn.getType() == connection.getType() ) {
                throw new IllegalArgumentException( "A RuleSetNode can have at most one outgoing node" );
            }
        }
    }
View Full Code Here

    }

    protected void validateAddOutgoingConnection(final Connection connection) {
        super.validateAddOutgoingConnection( connection );
        for ( final Iterator it = getOutgoingConnections().iterator(); it.hasNext(); ) {
            final Connection conn = (Connection) it.next();
            if ( conn.getType() == connection.getType() ) {
                throw new IllegalArgumentException( "A MilestoneNode can have at most one outgoing node" );
            }
        }
    }
View Full Code Here

    }

    protected void validateAddOutgoingConnection(final Connection connection) {
        super.validateAddOutgoingConnection( connection );
        for ( final Iterator it = getOutgoingConnections().iterator(); it.hasNext(); ) {
            final Connection conn = (Connection) it.next();
            if ( conn.getType() == connection.getType() ) {
                throw new IllegalArgumentException( "An ActionNode can have at most one outgoing node" );
            }
        }
    }
View Full Code Here

        final Split split = getSplitNode();
        switch ( split.getType() ) {
            case Split.TYPE_AND :
                List outgoing = split.getOutgoingConnections();
                for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
                    final Connection connection = (Connection) iterator.next();
                    getProcessInstance().getNodeInstance( connection.getTo() ).trigger( this );
                }
                break;
            case Split.TYPE_XOR :
                outgoing = split.getOutgoingConnections();
                int priority = Integer.MAX_VALUE;
                Connection selected = null;
              RuleFlowGroup systemRuleFlowGroup = getProcessInstance().getAgenda().getRuleFlowGroup("DROOLS_SYSTEM");
                for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
                    final Connection connection = (Connection) iterator.next();
                    Constraint constraint = split.getConstraint(connection);
                    if (constraint != null && constraint.getPriority() < priority) {
                      String rule = "RuleFlow-Split-" + getProcessInstance().getProcess().getId() + "-" +
                    getNode().getId() + "-" + connection.getTo().getId();
                      for (Iterator activations = systemRuleFlowGroup.iterator(); activations.hasNext(); ) {
                        Activation activation = ((RuleFlowGroupNode) activations.next()).getActivation();
                        if (rule.equals(activation.getRule().getName())) {
                            selected = connection;
                            priority = constraint.getPriority();
                            break;
                        }
                      }
                    }
                }
                if (selected == null) {
                  throw new IllegalArgumentException("XOR split could not find at least one valid outgoing connection for split " + getSplitNode().getName());
                }
                getProcessInstance().getNodeInstance( selected.getTo() ).trigger( this );
                break;
            case Split.TYPE_OR :
                outgoing = split.getOutgoingConnections();
                boolean found = false;
              systemRuleFlowGroup = getProcessInstance().getAgenda().getRuleFlowGroup("DROOLS_SYSTEM");
                for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
                    final Connection connection = (Connection) iterator.next();
                    Constraint constraint = split.getConstraint(connection);
                    if (constraint != null) {
                      String rule = "RuleFlow-Split-" + getProcessInstance().getProcess().getId() + "-" +
                        getNode().getId() + "-" + connection.getTo().getId();
                      for (Iterator activations = systemRuleFlowGroup.iterator(); activations.hasNext(); ) {
                        Activation activation = ((RuleFlowGroupNode) activations.next()).getActivation();
                        if (rule.equals(activation.getRule().getName())) {
                                getProcessInstance().getNodeInstance( connection.getTo() ).trigger( this );
                                found = true;
                            break;
                        }
                      }
                    }
View Full Code Here

    }

    private void checkActivation() {
        // check whether all parent nodes have been triggered
        for ( final Iterator it = getJoinNode().getIncomingConnections().iterator(); it.hasNext(); ) {
            final Connection connection = (Connection) it.next();
            if ( this.triggers.get( connection.getFrom() ) == null ) {
                return;
            }
        }
        // if true, decrease trigger count for all parents and trigger children
        for ( final Iterator it = getJoinNode().getIncomingConnections().iterator(); it.hasNext(); ) {
            final Connection connection = (Connection) it.next();
            final Integer count = (Integer) this.triggers.get( connection.getFrom() );
            if ( count.intValue() == 1 ) {
                this.triggers.remove( connection.getFrom() );
            } else {
                this.triggers.put( connection.getFrom(),
                                   new Integer( count.intValue() - 1 ) );
            }
        }
        triggerCompleted();
    }
View Full Code Here

    }

    protected void validateAddOutgoingConnection(final Connection connection) {
        super.validateAddOutgoingConnection( connection );
        for ( final Iterator it = getOutgoingConnections().iterator(); it.hasNext(); ) {
            final Connection conn = (Connection) it.next();
            if ( conn.getType() == connection.getType() ) {
                throw new IllegalArgumentException( "A MilestoneNode can have at most one outgoing node" );
            }
        }
    }
View Full Code Here

        for (int i = 0; i < nodes.length; i++) {
           if (nodes[i] instanceof Split) {
             Split split = (Split) nodes[i];
             if (split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR) {
               for (Iterator iterator = split.getOutgoingConnections().iterator(); iterator.hasNext(); ) {
                 Connection connection = (Connection) iterator.next();
                 result += createSplitRule(process, connection, split.getConstraint(connection).getConstraint());
               }
             }
           } else if (nodes[i] instanceof MilestoneNode) {
             MilestoneNode milestone = (MilestoneNode) nodes[i];
View Full Code Here

TOP

Related Classes of org.drools.ruleflow.core.Connection

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.