Package org.drools.ruleflow.core

Examples of org.drools.ruleflow.core.Constraint


                        ruleSet3,
                        Connection.TYPE_NORMAL );
        new ConnectionImpl( ruleSet3,
                        end,
                        Connection.TYPE_NORMAL );
        Constraint constraint1 = new org.drools.ruleflow.core.impl.ConstraintImpl();
        constraint1.setPriority(1);
        split.setConstraint(out1, constraint1);
        Constraint constraint2 = new org.drools.ruleflow.core.impl.ConstraintImpl();
        constraint2.setPriority(2);
        split.setConstraint(out2, constraint2);

        // process
        final RuleFlowProcess process = new RuleFlowProcessImpl();
        process.setId( "1" );
View Full Code Here


                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();
View Full Code Here

                        ruleSet3,
                        Connection.TYPE_NORMAL );
        new ConnectionImpl( ruleSet3,
                        end,
                        Connection.TYPE_NORMAL );
        Constraint constraint1 = new org.drools.ruleflow.core.impl.ConstraintImpl();
        constraint1.setPriority(1);
        split.setConstraint(out1, constraint1);
        Constraint constraint2 = new org.drools.ruleflow.core.impl.ConstraintImpl();
        constraint2.setPriority(2);
        split.setConstraint(out2, constraint2);

        // process
        final RuleFlowProcess process = new RuleFlowProcessImpl();
        process.setId( "1" );
View Full Code Here

                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-" + 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-" + getProcessInstance().getProcess().getId() + "-" +
                        getNode().getId() + "-" + connection.getTo().getId();
                      for (Iterator activations = systemRuleFlowGroup.iterator(); activations.hasNext(); ) {
                        Activation activation = ((RuleFlowGroupNode) activations.next()).getActivation();
View Full Code Here

TOP

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

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.