use of org.drools.core.common.PhreakPropagationContext in project drools by kiegroup.
the class RightBuilder method update.
public RightBuilder update(Object... objects) {
for (Object object : objects) {
InternalFactHandle fh = (InternalFactHandle) wm.insert(object);
RightTuple rightTuple = fh.getFirstRightTuple();
rightTuple.setPropagationContext(new PhreakPropagationContext());
rightTuples.addUpdate(rightTuple);
}
return this;
}
use of org.drools.core.common.PhreakPropagationContext in project drools by kiegroup.
the class RightMemory method getRightTuples.
public List<RightTuple> getRightTuples(Object... objects) {
BetaNode node = scenario.getBetaNode();
BetaMemory bm = scenario.getBm();
TupleMemory rtm = bm.getRightTupleMemory();
InternalWorkingMemory wm = scenario.getWorkingMemory();
if (objects == null) {
objects = new Object[0];
}
List<RightTuple> rightTuples = new ArrayList<RightTuple>();
for (Object object : objects) {
InternalFactHandle fh = (InternalFactHandle) wm.insert(object);
// node.createLeftTuple( fh, node, true );
RightTuple expectedRightTuple = new RightTupleImpl(fh, node);
expectedRightTuple.setPropagationContext(new PhreakPropagationContext());
rightTuples.add(expectedRightTuple);
}
scenario.setTestRightMemory(true);
return rightTuples;
}
use of org.drools.core.common.PhreakPropagationContext in project drools by kiegroup.
the class RuleUnitExecutorImpl method getQueryResults.
@Override
public QueryResults getQueryResults(String queryName, Object... arguments) {
activationsManager.flushPropagations();
DroolsQuery queryObject = new DroolsQuery(queryName, arguments, new NonCloningQueryViewListener(), false);
InternalFactHandle handle = this.handleFactory.newFactHandle(queryObject, null, this, getDefaultEntryPoint());
final PropagationContext pCtx = new PhreakPropagationContext(getNextPropagationIdCounter(), PropagationContext.Type.INSERTION, null, null, handle, getDefaultEntryPointId());
PropagationEntry.ExecuteQuery executeQuery = new PropagationEntry.ExecuteQuery(queryName, queryObject, handle, pCtx, false);
addPropagation(executeQuery);
TerminalNode[] terminalNodes = executeQuery.getResult();
List<Map<String, Declaration>> decls = new ArrayList<>();
if (terminalNodes != null) {
for (TerminalNode node : terminalNodes) {
decls.add(node.getSubRule().getOuterDeclarations());
}
}
this.handleFactory.destroyFactHandle(handle);
return new QueryResultsImpl((List<QueryRowWithSubruleIndex>) queryObject.getQueryResultCollector().getResults(), decls.toArray(new Map[decls.size()]), this, (queryObject.getQuery() != null) ? queryObject.getQuery().getParameters() : new Declaration[0]);
}
use of org.drools.core.common.PhreakPropagationContext in project drools by kiegroup.
the class LeftBuilder method delete.
public LeftBuilder delete(Object... objects) {
for (Object object : objects) {
InternalFactHandle fh = (InternalFactHandle) wm.getFactHandle(object);
LeftTuple leftTuple = fh.getFirstLeftTuple();
leftTuple.setPropagationContext(new PhreakPropagationContext());
leftTuples.addDelete(leftTuple);
}
return this;
}
use of org.drools.core.common.PhreakPropagationContext in project drools by kiegroup.
the class LeftBuilder method update.
public LeftBuilder update(Object... objects) {
for (Object object : objects) {
InternalFactHandle fh = (InternalFactHandle) wm.getFactHandle(object);
LeftTuple leftTuple = fh.getFirstLeftTuple();
leftTuple.setPropagationContext(new PhreakPropagationContext());
leftTuples.addUpdate(leftTuple);
}
return this;
}
Aggregations