use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class UpdateInEntryPointCommand method execute.
public Void execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
EntryPoint ep = ksession.getEntryPoint(entryPoint);
if (modifiedProperties != null) {
ep.update(handle, object, modifiedProperties);
} else {
ep.update(handle, object);
}
return null;
}
use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class ExecuteCommand method execute.
public ExecutionResults execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
ExecutionResults kresults = ksession.execute(this.command);
if (this.outIdentifier != null) {
((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, kresults);
}
if (disconnected) {
ExecutionResultImpl disconnectedResults = new ExecutionResultImpl();
HashMap<String, Object> disconnectedHandles = new HashMap<String, Object>();
for (String key : kresults.getIdentifiers()) {
FactHandle handle = (FactHandle) kresults.getFactHandle(key);
if (handle != null) {
DefaultFactHandle disconnectedHandle = ((DefaultFactHandle) handle).clone();
disconnectedHandle.disconnect();
disconnectedHandles.put(key, disconnectedHandle);
}
}
disconnectedResults.setFactHandles(disconnectedHandles);
disconnectedResults.setResults((HashMap) ((ExecutionResultImpl) kresults).getResults());
return disconnectedResults;
}
return kresults;
}
use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class GetKieContainerCommand method execute.
public KieContainer execute(Context context) {
// use the new API to retrieve the session by ID
KieServices kieServices = KieServices.Factory.get();
KieContainer kieContainer = kieServices.newKieContainer(releaseId);
((RegistryContext) context).register(KieContainer.class, kieContainer);
return kieContainer;
}
use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class SetActiveAgendaGroup method execute.
@Override
public Void execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
ksession.getAgenda().getAgendaGroup(agendaGroup).setFocus();
return null;
}
use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class SetGlobalCommand method execute.
public Object execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
if (this.outIdentifier != null) {
((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, object);
}
ksession.setGlobal(this.identifier, this.object);
// returning the object is necessary for drools-simulator
return this.object;
}
Aggregations