use of org.drools.core.common.PropagationContextFactory in project drools by kiegroup.
the class AddRemoveRule method insertFacts.
private static void insertFacts(PathEndNodes endNodes, Collection<InternalWorkingMemory> wms) {
Set<LeftTupleNode> visited = new HashSet<>();
for (PathEndNode endNode : endNodes.subjectEndNodes) {
LeftTupleNode[] nodes = endNode.getPathNodes();
for (int i = 0; i < nodes.length; i++) {
LeftTupleNode node = nodes[i];
if (NodeTypeEnums.isBetaNode(node) && node.getAssociationsSize() == 1) {
if (!visited.add(node)) {
// this is to avoid rentering a path, and processing nodes twice. This can happen for nested subnetworks.
continue;
}
BetaNode bn = (BetaNode) node;
if (!bn.isRightInputIsRiaNode()) {
for (InternalWorkingMemory wm : wms) {
PropagationContextFactory pctxFactory = RuntimeComponentFactory.get().getPropagationContextFactory();
final PropagationContext pctx = pctxFactory.createPropagationContext(wm.getNextPropagationIdCounter(), PropagationContext.Type.RULE_ADDITION, null, null, null);
bn.getRightInput().updateSink(bn, pctx, wm);
}
}
}
}
}
}
use of org.drools.core.common.PropagationContextFactory in project drools by kiegroup.
the class ReteObjectTypeNode method doAttach.
public void doAttach(BuildContext context) {
super.doAttach(context);
if (context == null) {
return;
}
// to working memories
for (InternalWorkingMemory workingMemory : context.getWorkingMemories()) {
PropagationContextFactory pctxFactory = RuntimeComponentFactory.get().getPropagationContextFactory();
final PropagationContext propagationContext = pctxFactory.createPropagationContext(workingMemory.getNextPropagationIdCounter(), PropagationContext.Type.RULE_ADDITION, null, null, null);
propagationContext.setEntryPoint(((EntryPointNode) this.source).getEntryPoint());
this.source.updateSink(this, propagationContext, workingMemory);
}
}
Aggregations