Search in sources :

Example 16 with RegistryContext

use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.

the class UnregisterChannelCommand method execute.

public Void execute(Context context) {
    KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
    ksession.unregisterChannel(name);
    return null;
}
Also used : KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext)

Example 17 with RegistryContext

use of org.drools.core.command.impl.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;
}
Also used : KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext)

Example 18 with RegistryContext

use of org.drools.core.command.impl.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;
}
Also used : KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext)

Example 19 with RegistryContext

use of org.drools.core.command.impl.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;
}
Also used : ExecutionResultImpl(org.drools.core.runtime.impl.ExecutionResultImpl) KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext) ProcessInstance(org.kie.api.runtime.process.ProcessInstance)

Example 20 with RegistryContext

use of org.drools.core.command.impl.RegistryContext in project drools by kiegroup.

the class AbortWorkItemCommand method execute.

public Void execute(Context context) {
    KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
    ksession.getWorkItemManager().abortWorkItem(workItemId);
    return null;
}
Also used : KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext)

Aggregations

RegistryContext (org.drools.core.command.impl.RegistryContext)58 KieSession (org.kie.api.runtime.KieSession)52 ExecutionResultImpl (org.drools.core.runtime.impl.ExecutionResultImpl)20 EntryPoint (org.kie.api.runtime.rule.EntryPoint)12 FactHandle (org.kie.api.runtime.rule.FactHandle)10 ArrayList (java.util.ArrayList)8 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)7 InternalFactHandle (org.drools.core.common.InternalFactHandle)6 DefaultFactHandle (org.drools.core.common.DefaultFactHandle)4 HashMap (java.util.HashMap)3 RequestContextImpl (org.drools.core.command.RequestContextImpl)3 Context (org.kie.api.runtime.Context)3 KieContainer (org.kie.api.runtime.KieContainer)3 Collection (java.util.Collection)2 List (java.util.List)2 Map (java.util.Map)2 EntryPointCreator (org.drools.core.command.EntryPointCreator)2 StatefulKnowledgeSessionImpl (org.drools.core.impl.StatefulKnowledgeSessionImpl)2 KieServices (org.kie.api.KieServices)2 CorrelationAwareProcessRuntime (org.kie.internal.process.CorrelationAwareProcessRuntime)2