use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class ApplyPmmlModelCommand method execute.
@Override
public PMML4Result execute(Context context) {
if (requestData == null) {
throw new IllegalStateException("ApplyPmmlModelCommand requires request data (PMMLRequestData) to execute");
}
RegistryContext registryContext = (RegistryContext) context;
PMML4Result toReturn = PMMLCommandExecutorFactory.get().newPMMLCommandExecutor().execute(requestData, context);
// Needed to update the ExecutionResultImpl and the Registry context,
// as done inside legacy implementation
Optional<ExecutionResultImpl> execRes = Optional.ofNullable(registryContext.lookup(ExecutionResultImpl.class));
registryContext.register(PMML4Result.class, toReturn);
execRes.ifPresent(result -> result.setResult("results", toReturn));
return toReturn;
}
use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class AbortProcessInstanceCommand method execute.
public Void execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
if (processInstanceId == null) {
return null;
}
ksession.abortProcessInstance(processInstanceId);
return null;
}
use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class CompleteWorkItemCommand method execute.
public Void execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
ksession.getWorkItemManager().completeWorkItem(workItemId, results);
return null;
}
use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class CreateProcessInstanceCommand method execute.
public ProcessInstance execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
if (data != null) {
for (Object o : data) {
ksession.insert(o);
}
}
ProcessInstance processInstance = (ProcessInstance) ksession.createProcessInstance(processId, parameters);
if (this.outIdentifier != null) {
((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, processInstance.getId());
}
return processInstance;
}
use of org.kie.internal.command.RegistryContext in project drools by kiegroup.
the class GetProcessInstanceCommand method execute.
public ProcessInstance execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
if (processInstanceId == null) {
return null;
}
final ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId, readOnly);
if (this.outIdentifier != null) {
((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, processInstance);
}
return processInstance;
}
Aggregations