use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class GetObjectsInEntryPointCommand method execute.
public Collection execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
EntryPoint ep = ksession.getEntryPoint(entryPoint);
Collection col = null;
if (filter != null) {
col = ep.getObjects(this.filter);
} else {
col = ep.getObjects();
}
if (this.outIdentifier != null) {
List objects = new ArrayList(col);
((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, objects);
}
return col;
}
use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class HaltCommand method execute.
public Void execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
ksession.halt();
return null;
}
use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class InsertObjectCommand method execute.
public FactHandle execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
FactHandle factHandle;
if (StringUtils.isEmpty(this.entryPoint)) {
factHandle = ksession.insert(object);
} else {
factHandle = ksession.getEntryPoint(this.entryPoint).insert(object);
}
if (outIdentifier != null) {
if (this.returnObject) {
((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, object);
}
((RegistryContext) context).lookup(ExecutionResultImpl.class).getFactHandles().put(this.outIdentifier, factHandle);
}
if (disconnected) {
DefaultFactHandle disconnectedHandle = ((DefaultFactHandle) factHandle).clone();
disconnectedHandle.disconnect();
return disconnectedHandle;
}
return factHandle;
}
use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class DeleteFromEntryPointCommand method execute.
public Void execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
ksession.getEntryPoint(entryPoint).delete(handle, fhState);
return null;
}
use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.
the class EnableAuditLogCommand method execute.
@Override
public Void execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
KieServices.Factory.get().getLoggers().newFileLogger(ksession, auditLogFile);
return null;
}
Aggregations