this.kruntime = kruntime;
}
public void addProcessInstance(ProcessInstance processInstance, CorrelationKey correlationKey) {
ProcessInstanceInfo processInstanceInfo = new ProcessInstanceInfo( processInstance, this.kruntime.getEnvironment() );
ProcessPersistenceContext context
= ((ProcessPersistenceContextManager) this.kruntime.getEnvironment()
.get( EnvironmentName.PERSISTENCE_CONTEXT_MANAGER ))
.getProcessPersistenceContext();
context.persist( processInstanceInfo );
((org.jbpm.process.instance.ProcessInstance) processInstance).setId( processInstanceInfo.getId() );
processInstanceInfo.updateLastReadDate();
// persist correlation if exists
if (correlationKey != null) {
CorrelationKeyInfo correlationKeyInfo = (CorrelationKeyInfo) correlationKey;
correlationKeyInfo.setProcessInstanceId(processInstanceInfo.getId());
context.persist(correlationKeyInfo);
}
internalAddProcessInstance(processInstance);
}