-
1. Re: jBPM process does not start?
wrzep Aug 11, 2008 2:50 PM (in response to sirlantis)Marcel,
A call to createJbpmProcess() isn't a call to a Seam proxy. It's just normal java call. That is why the @CreateProcess annotation has no effect.
Cheers,
-Pawel -
2. Re: jBPM process does not start?
sirlantis Aug 11, 2008 2:57 PM (in response to sirlantis)Thanks for the fast reply, Pawel.
Works just fine now - Another thing learned about Seam.
-
3. Re: jBPM process does not start?
uesker Aug 30, 2010 2:08 PM (in response to sirlantis)Hi!
How can I use that approach and still call a seam proxy.Examplaxe
public void begin() { if there is an already process deploy { do something; return "/page.xhtml"; } else { createJbpmProcess(); } } @CreateProcess(definition="order") private String createJbpmProcess() { log.info(TestHelper.class.getCanonicalName(), "started jBPM process"); return "/page.xhtml"; }
-
4. Re: jBPM process does not start?
lvdberg Aug 30, 2010 2:38 PM (in response to sirlantis)Hi,
You have to look up the processinstance with the help of jbpmContext. The method which you call must be transactional and (because you want it to be conditional) should start up the procees itself - without the annotation,
The next does more or less what you want to do:
@In(required = false) JbpmContext jbpmContext; @Transactional public void startSomething(){ // find the instance using the processdefinition GraphSession gs = jbpmContext.getGraphSession(); ProcessDefinition def = gs.findLatestProcessDefinition("order"); // The next will return null if there is no such instance present // Be aware that this is a sort of Singleton process, so you just can have on // ProcessInstance with this approach... ProcessInstance pi = jbpmContext.getProcessInstance(def, null); if (pi == null) { ProcessInstance pi = new ProcessInstance(def); Token tkn = pi.getRootToken(); tkn.signal(); etc, etc. .... }
-
5. Re: jBPM process does not start?
uesker Aug 31, 2010 10:46 AM (in response to sirlantis)
Leo van den Berg wrote on Aug 30, 2010 14:38:
Hi,
You have to look up the processinstance with the help of jbpmContext. The method which you call must be transactional and (because you want it to be conditional) should start up the procees itself - without the annotation,
The next does more or less what you want to do:@In(required = false) JbpmContext jbpmContext; @Transactional public void startSomething(){ // find the instance using the processdefinition GraphSession gs = jbpmContext.getGraphSession(); ProcessDefinition def = gs.findLatestProcessDefinition("order"); // The next will return null if there is no such instance present // Be aware that this is a sort of Singleton process, so you just can have on // ProcessInstance with this approach... ProcessInstance pi = jbpmContext.getProcessInstance(def, null); if (pi == null) { ProcessInstance pi = new ProcessInstance(def); Token tkn = pi.getRootToken(); tkn.signal(); etc, etc. .... }
Hi,
appreciate your help!One last question: I added the a key to ProcessInstance to help to obtain a specific ProcessInstance.
The ideia now is to obtain a list of pooled task associated with this ProcessInstance. How can I do this?
Here is my modified code@Transactional public String begin() { GraphSession gs = jbpmContext.getGraphSession(); ProcessDefinition def = gs.findLatestProcessDefinition("buildProtocol"); String processInstanceKey = "pik_" + idProject; ProcessInstance pi = jbpmContext.getProcessInstance(def, processInstanceKey); if (pi == null) { pi = new ProcessInstance(def, null); pi.setKey(processInstanceKey); Token tkn = pi.getRootToken(); tkn.signal(); } else { //TODO: Query for Pooled Task List associated with this Process Instance pi.resume(); } return "/listActivities.xhtml"; }
Sorry for any inconvenience, this is my first project using JBPM.
Thanks! -
6. Re: jBPM process does not start?
lvdberg Aug 31, 2010 2:44 PM (in response to sirlantis)Hi,
There are different possibilities:
pi.getTaskMgmtInstance().getTaskInstances();
jbpmContext.getTaskList(actorId);or you can get directly a list from a Seam managed bean,
taskInstanceList
taskInstancePriorityList
taskInstanceListForType
pooledTaskInstanceListYou can download the free JBPM chapter of Seam in Action from the Manning.com website. It explains very good the possibilities of these beans.
Leo