LeftTupleSource lts = tnode.getLeftTupleSource();
while ( lts.getType() != NodeTypeEnums.LeftInputAdapterNode ) {
lts = lts.getLeftTupleSource();
}
LeftInputAdapterNode lian = ( LeftInputAdapterNode ) lts;
LiaNodeMemory lmem = (LiaNodeMemory) getNodeMemory( (MemoryFactory) lts);
SegmentMemory lsmem = lmem.getSegmentMemory();
if ( lsmem == null ) {
lsmem = SegmentUtilities.createSegmentMemory(lts, this);
}
// TODO this is OTT, it shouldn't need to do this for ALL rules, just those rules that event stream inputs (mdp)
RuleBaseConfiguration conf = this.ruleBase.getConfiguration();
if( conf.isPhreakEnabled() && conf.getEventProcessingMode().equals(EventProcessingOption.STREAM) ) {
lmem.linkNode(this);
List<PathMemory> pmems = lmem.getSegmentMemory().getPathMemories();
PathMemory pmm = pmems!=null && !pmems.isEmpty() ? pmems.get(0) : null;
if( pmm != null && pmm.getRuleAgendaItem() != null ) {
RuleAgendaItem item = pmm.getRuleAgendaItem();
item.getRuleExecutor().reEvaluateNetwork( this, new org.drools.core.util.LinkedList<StackEntry>(), false);
}
}
LeftInputAdapterNode.doInsertObject( handle, pCtx, lian, this, lmem, false, queryObject.isOpen() );
List<PathMemory> pmems = lmem.getSegmentMemory().getPathMemories();
for ( int i = 0, length = pmems.size(); i < length; i++ ) {
PathMemory rm = pmems.get( i );
RuleAgendaItem evaluator = agenda.createRuleAgendaItem(Integer.MAX_VALUE, rm, (TerminalNode) rm.getNetworkNode());
evaluator.getRuleExecutor().setDirty(true);
evaluator.getRuleExecutor().evaluateNetworkAndFire(this, null, 0, -1);