use of org.drools.core.command.impl.RegistryContext 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;
}
use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class UpdateCommand method execute.
public Void execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
EntryPoint ep = ksession.getEntryPoint(handle.getEntryPointId());
if (modifiedProperties != null) {
ep.update(handle, object, modifiedProperties);
} else {
ep.update(handle, object);
}
return null;
}
use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class GetEntryPointsCommand method execute.
public Collection<? extends EntryPoint> execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
Collection<? extends EntryPoint> eps = ksession.getEntryPoints();
EntryPointCreator epCreator = (EntryPointCreator) context.get(EntryPointCreator.class.getName());
if (epCreator == null) {
return eps;
}
Collection<EntryPoint> result = new ArrayList<EntryPoint>();
for (EntryPoint ep : eps) {
result.add(epCreator.getEntryPoint(ep.getEntryPointId()));
}
return result;
}
use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class GetFactHandleInEntryPointCommand method execute.
public FactHandle execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
EntryPoint ep = ksession.getEntryPoint(entryPoint);
InternalFactHandle factHandle = (InternalFactHandle) ep.getFactHandle(object);
if (factHandle != null) {
InternalFactHandle handle = factHandle.clone();
if (disconnected) {
handle.disconnect();
}
return handle;
}
return null;
}
use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class GetObjectInEntryPointCommand method execute.
public Object execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
EntryPoint ep = ksession.getEntryPoint(entryPoint);
Object object = ep.getObject(factHandle);
if (this.outIdentifier != null) {
((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, object);
}
return object;
}
Aggregations