TC ONG [
https://community.jboss.org/people/devilkazuya99] created the discussion
"Re: Continue Previous Process Instance"
To view the discussion, visit:
https://community.jboss.org/message/740585#740585
--------------------------------------------------------------
Found these on GitHub:
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-persistence-jpa/src/t...
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-persistence-jpa/src/t...
May be I have to recreate the processInstance with the id i have. Will tell you the
outcome.
@Test
public void testWithDatabaseAndStartProcessInstance() throws Exception {
// Create variable
Map params = new HashMap();
NonSerializableClass processVar = new NonSerializableClass();
processVar.setString("1234567890");
params.put(VAR_NAME, processVar);
// Persist variable
UserTransaction ut = (UserTransaction) new
InitialContext().lookup("java:comp/UserTransaction");
ut.begin();
EntityManagerFactory emf = (EntityManagerFactory)
context.get(ENTITY_MANAGER_FACTORY);
EntityManager em = emf.createEntityManager();
em.setFlushMode(FlushModeType.COMMIT);
em.joinTransaction();
em.persist(processVar);
em.close();
ut.commit();
// Create process,
ProcessInstance processInstance = ksession.createProcessInstance(PROCESS_ID,
params);
long processInstanceId = processInstance.getId();
Assert.assertTrue(processInstanceId > 0);
Assert.assertEquals(ProcessInstance.STATE_PENDING, processInstance.getState());
// insert process,
ksession.insert(processInstance);
// and start process
ksession.startProcessInstance(processInstanceId);
ksession.fireAllRules();
// Test results
processInstance = ksession.getProcessInstance(processInstanceId);
Assert.assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
processVar = (NonSerializableClass) ((WorkflowProcessInstance)
processInstance).getVariable(VAR_NAME);
Assert.assertNotNull(processVar);
}
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/740585#740585]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]