use of org.kie.api.runtime.rule.Variable in project drools by kiegroup.
the class MvelConstraint method isAllowedCachedRight.
public boolean isAllowedCachedRight(Tuple tuple, ContextEntry context) {
if (isUnification) {
DroolsQuery query = (DroolsQuery) tuple.get(0).getObject();
Variable v = query.getVariables()[((UnificationContextEntry) context).getReader().getIndex()];
if (v != null) {
return true;
}
context = ((UnificationContextEntry) context).getContextEntry();
}
MvelContextEntry mvelContextEntry = (MvelContextEntry) context;
return evaluate(mvelContextEntry.rightHandle, mvelContextEntry.workingMemory, tuple);
}
use of org.kie.api.runtime.rule.Variable in project drools by kiegroup.
the class QueryCommand method execute.
public QueryResults execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
if (this.arguments == null || this.arguments.isEmpty()) {
this.arguments = Collections.emptyList();
}
for (int j = 0; j < arguments.size(); j++) {
if (arguments.get(j) instanceof Variable) {
arguments.set(j, Variable.v);
}
}
QueryResults results = ksession.getQueryResults(name, this.arguments.toArray());
if (this.outIdentifier != null) {
((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, new FlatQueryResults((QueryResultsImpl) results));
}
return results;
}
Aggregations