Search in sources :

Example 1 with ProcessInstance

use of org.kie.api.runtime.process.ProcessInstance 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 2 with ProcessInstance

use of org.kie.api.runtime.process.ProcessInstance in project drools by kiegroup.

the class GetProcessInstancesCommand method execute.

public Collection<ProcessInstance> execute(Context context) {
    KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
    Collection<ProcessInstance> instances = ksession.getProcessInstances();
    Collection<ProcessInstance> result = new ArrayList<ProcessInstance>();
    for (ProcessInstance instance : instances) {
        result.add(instance);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext) ProcessInstance(org.kie.api.runtime.process.ProcessInstance)

Example 3 with ProcessInstance

use of org.kie.api.runtime.process.ProcessInstance in project drools by kiegroup.

the class StartProcessCommand 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.startProcess(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 4 with ProcessInstance

use of org.kie.api.runtime.process.ProcessInstance in project drools by kiegroup.

the class StartCorrelatedProcessCommand 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 = ((CorrelationAwareProcessRuntime) ksession).startProcess(processId, correlationKey, parameters);
    if (this.outIdentifier != null) {
        ((RegistryContext) context).lookup(ExecutionResultImpl.class).setResult(this.outIdentifier, processInstance.getId());
    }
    return processInstance;
}
Also used : CorrelationAwareProcessRuntime(org.kie.internal.process.CorrelationAwareProcessRuntime) 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 5 with ProcessInstance

use of org.kie.api.runtime.process.ProcessInstance in project drools by kiegroup.

the class StartProcessInstanceCommand method execute.

public ProcessInstance execute(Context context) {
    KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
    ProcessInstance processInstance = (ProcessInstance) ksession.startProcessInstance(processInstanceId);
    return processInstance;
}
Also used : KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext) ProcessInstance(org.kie.api.runtime.process.ProcessInstance)

Aggregations

ProcessInstance (org.kie.api.runtime.process.ProcessInstance)12 RegistryContext (org.drools.core.command.impl.RegistryContext)7 KieSession (org.kie.api.runtime.KieSession)7 ExecutionResultImpl (org.drools.core.runtime.impl.ExecutionResultImpl)4 WorkItem (org.drools.core.process.instance.WorkItem)3 Map (java.util.Map)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 PersistenceContext (org.drools.persistence.api.PersistenceContext)2 WorkItemInfo (org.drools.persistence.info.WorkItemInfo)2 WorkflowProcessInstance (org.kie.api.runtime.process.WorkflowProcessInstance)2 CorrelationAwareProcessRuntime (org.kie.internal.process.CorrelationAwareProcessRuntime)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 WorkingMemoryEntryPoint (org.drools.core.WorkingMemoryEntryPoint)1 InternalRuleFlowGroup (org.drools.core.common.InternalRuleFlowGroup)1 InternalWorkingMemoryEntryPoint (org.drools.core.common.InternalWorkingMemoryEntryPoint)1 NamedEntryPoint (org.drools.core.common.NamedEntryPoint)1 WorkItemImpl (org.drools.core.process.instance.impl.WorkItemImpl)1 NodeInstance (org.kie.api.runtime.process.NodeInstance)1 NodeInstanceContainer (org.kie.api.runtime.process.NodeInstanceContainer)1