Search in sources :

Example 6 with XpathConstraint

use of org.drools.core.rule.constraint.XpathConstraint in project drools by kiegroup.

the class ReactiveFromBuilder method build.

public void build(final BuildContext context, final BuildUtils utils, final RuleConditionElement rce) {
    final From from = (From) rce;
    context.pushRuleComponent(from);
    @SuppressWarnings("unchecked") BetaConstraints betaConstraints = utils.createBetaNodeConstraint(context, context.getBetaconstraints(), true);
    AlphaNodeFieldConstraint[] alphaNodeFieldConstraints = context.getAlphaConstraints() != null ? context.getAlphaConstraints().toArray(new AlphaNodeFieldConstraint[context.getAlphaConstraints().size()]) : new AlphaNodeFieldConstraint[0];
    ReactiveFromNode node = CoreComponentFactory.get().getNodeFactoryService().buildReactiveFromNode(context.getNextNodeId(), from.getDataProvider(), context.getTupleSource(), alphaNodeFieldConstraints, betaConstraints, context.isTupleMemoryEnabled(), context, from);
    context.setTupleSource(utils.attachNode(context, node));
    context.setAlphaConstraints(null);
    context.setBetaconstraints(null);
    List<XpathConstraint> xpathConstraints = context.getXpathConstraints();
    for (XpathConstraint xpathConstraint : xpathConstraints) {
        for (XpathConstraint.XpathChunk chunk : xpathConstraint.getChunks()) {
            context.setAlphaConstraints(chunk.getAlphaConstraints());
            context.setBetaconstraints(chunk.getBetaConstraints());
            context.setXpathConstraints(chunk.getXpathConstraints());
            build(context, utils, chunk.asFrom());
        }
    }
}
Also used : XpathConstraint(org.drools.core.rule.constraint.XpathConstraint) BetaConstraints(org.drools.core.common.BetaConstraints) AlphaNodeFieldConstraint(org.drools.core.spi.AlphaNodeFieldConstraint) ReactiveFromNode(org.drools.core.reteoo.ReactiveFromNode) From(org.drools.core.rule.From)

Aggregations

XpathConstraint (org.drools.core.rule.constraint.XpathConstraint)6 ClassObjectType (org.drools.core.base.ClassObjectType)3 Constraint (org.drools.core.spi.Constraint)3 ArrayList (java.util.ArrayList)2 XpathPart (org.drools.compiler.rule.builder.XpathAnalysis.XpathPart)2 FactTemplateObjectType (org.drools.core.facttemplates.FactTemplateObjectType)2 Declaration (org.drools.core.rule.Declaration)2 PredicateConstraint (org.drools.core.rule.PredicateConstraint)2 TypeDeclaration (org.drools.core.rule.TypeDeclaration)2 XpathBackReference (org.drools.core.rule.XpathBackReference)2 NegConstraint (org.drools.core.rule.constraint.NegConstraint)2 AcceptsClassObjectType (org.drools.core.spi.AcceptsClassObjectType)2 AlphaNodeFieldConstraint (org.drools.core.spi.AlphaNodeFieldConstraint)2 ObjectType (org.drools.core.spi.ObjectType)2 BindingDescr (org.drools.compiler.lang.descr.BindingDescr)1 ConstraintConnectiveDescr (org.drools.compiler.lang.descr.ConstraintConnectiveDescr)1 ExprConstraintDescr (org.drools.compiler.lang.descr.ExprConstraintDescr)1 ExpressionDescr (org.drools.compiler.lang.descr.ExpressionDescr)1 BetaConstraints (org.drools.core.common.BetaConstraints)1 ReactiveFromNode (org.drools.core.reteoo.ReactiveFromNode)1