use of org.jbpm.process.instance.ProcessRuntimeImpl in project jbpm by kiegroup.
the class ProcessInstanceResolverStrategy method retrieveProcessInstanceManager.
/**
* Retrieve the {@link ProcessInstanceManager} object from the ObjectOutput- or ObjectInputStream.
* The stream object will secretly also either be a {@link MarshallerReaderContext} or a
* {@link MarshallerWriteContext}.
* @param streamContext The marshaller stream/context.
* @return A {@link ProcessInstanceManager} object.
*/
public static ProcessInstanceManager retrieveProcessInstanceManager(Object streamContext) {
ProcessInstanceManager pim = null;
if (streamContext instanceof MarshallerWriteContext) {
MarshallerWriteContext context = (MarshallerWriteContext) streamContext;
pim = ((ProcessRuntimeImpl) ((InternalWorkingMemory) context.wm).getProcessRuntime()).getProcessInstanceManager();
} else if (streamContext instanceof MarshallerReaderContext) {
MarshallerReaderContext context = (MarshallerReaderContext) streamContext;
pim = ((ProcessRuntimeImpl) ((InternalWorkingMemory) context.wm).getProcessRuntime()).getProcessInstanceManager();
} else {
throw new UnsupportedOperationException("Unable to retrieve " + ProcessInstanceManager.class.getSimpleName() + " from " + streamContext.getClass().getName());
}
return pim;
}
use of org.jbpm.process.instance.ProcessRuntimeImpl in project jbpm by kiegroup.
the class InMemorySessionFactory method newKieSession.
@Override
public KieSession newKieSession() {
Environment env = environment.getEnvironment();
env.set(EnvironmentName.DEPLOYMENT_ID, owner);
KieSession ksession = kbase.newKieSession(environment.getConfiguration(), env);
this.sessions.put(ksession.getIdentifier(), ksession);
ProcessInstanceManager piManager = ((ProcessRuntimeImpl) ((StatefulKnowledgeSessionImpl) ksession).getProcessRuntime()).getProcessInstanceManager();
if (piManager instanceof DefaultProcessInstanceManager) {
((DefaultProcessInstanceManager) piManager).setProcessCounter(processCounter);
}
return ksession;
}
Aggregations