Search in sources :

Example 1 with WindowReference

use of org.drools.core.rule.WindowReference in project drools by kiegroup.

the class PatternBuilder method buildBehaviors.

private void buildBehaviors(BuildContext context, BuildUtils utils, Pattern pattern, Constraints constraints) {
    final List<Behavior> behaviors = pattern.getBehaviors();
    if (pattern.getSource() == null || (!(pattern.getSource() instanceof WindowReference) && (context.getCurrentEntryPoint() != EntryPointId.DEFAULT || !behaviors.isEmpty()))) {
        attachObjectTypeNode(context, utils, pattern);
    }
    if (!behaviors.isEmpty()) {
        // build the window node:
        WindowNode wn = context.getComponentFactory().getNodeFactoryService().buildWindowNode(context.getNextId(), constraints.alphaConstraints, behaviors, context.getObjectSource(), context);
        context.setObjectSource(utils.attachNode(context, wn));
        // alpha constraints added to the window node already
        constraints.alphaConstraints.clear();
    }
}
Also used : WindowNode(org.drools.core.reteoo.WindowNode) Behavior(org.drools.core.rule.Behavior) WindowReference(org.drools.core.rule.WindowReference)

Example 2 with WindowReference

use of org.drools.core.rule.WindowReference in project drools by kiegroup.

the class WindowReferenceBuilder method build.

/* (non-Javadoc)
     * @see org.kie.reteoo.builder.ReteooComponentBuilder#build(org.kie.reteoo.builder.BuildContext, org.kie.reteoo.builder.BuildUtils, org.kie.rule.RuleConditionElement)
     */
public void build(BuildContext context, BuildUtils utils, RuleConditionElement rce) {
    final WindowReference window = (WindowReference) rce;
    final WindowNode node = context.getKnowledgeBase().getReteooBuilder().getWindowNode(window.getName());
    context.setObjectSource(node);
    context.setCurrentEntryPoint(node.getEntryPoint());
}
Also used : WindowNode(org.drools.core.reteoo.WindowNode) WindowReference(org.drools.core.rule.WindowReference)

Aggregations

WindowNode (org.drools.core.reteoo.WindowNode)2 WindowReference (org.drools.core.rule.WindowReference)2 Behavior (org.drools.core.rule.Behavior)1