jBPM Question
jeremyrd Jan 20, 2009 3:13 PMI have processes running in jBPM. They are kicked off by quartz and do not require user interaction.
I am trying to wrap them with seam so that user interaction is possible even though it isn't required.
I have been running into some problems with the standalone processes in my seam app.
I created a page with a button to kick off the process.
The process starts and transitions to the first node. The appropriate method is called. However the processInstance, jbpmContext, businessProcess are all null.
Does this use case make sense for seam's jbpm support? Should I leave the standalone process deployed as a jBPM par and use seam only for the user interaction?
Thanks,
Jeremy
process defintion :
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="Test Process 2">
<start-state name="Start Test Process">
<transition to="Begin Test" name="to_begin_test"></transition>
</start-state>
<node name="Begin Test">
<action name="begin test action" expression="#{processTester.beginTest()}" ></action>
<transition to="Run Test" name="to_run_test"></transition>
</node>
<node name="Run Test">
<action name="Run Test Action" expression="#{processTester.runTest()}"></action>
<transition to="Test Completed" name="to_test_completed"></transition>
</node>
<end-state name="Test Completed"></end-state>
</process-definition>
components.xml :
<!-- For use with jBPM pageflow or process management -->
<bpm:jbpm>
<bpm:process-definitions>
<value>testprocess.jpdl.xml</value>
</bpm:process-definitions>
<!--
<bpm:pageflow-definitions></bpm:pageflow-definitions>
-->
</bpm:jbpm>
slsb :
import javax.ejb.Stateless;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.bpm.BeginTask;
import org.jboss.seam.annotations.bpm.CreateProcess;
import org.jboss.seam.annotations.bpm.EndTask;
import org.jboss.seam.annotations.bpm.Transition;
import org.jboss.seam.bpm.Actor;
import org.jboss.seam.bpm.BusinessProcess;
import org.jboss.seam.log.Log;
import org.jboss.seam.security.Identity;
import org.jbpm.JbpmContext;
import org.jbpm.graph.exe.ProcessInstance;
@Stateless
@Name("processTester")
public class ProcessTester implements IProcessTester {
private static final long serialVersionUID = -8381313002070494166L;
@Logger
Log log;
@In(required=false)
Identity identity;
@In(required=false) @Out(required=false)
ProcessInstance processInstance;
@In(required=false)
BusinessProcess businessProcess;
@In(required=false)
JbpmContext jbpmContext;
@BeginTask @EndTask @Transition("to_run_test")
public void beginTest(){
log.debug("executing beginTest");
if(processInstance != null){
log.debug(processInstance.getProcessDefinition().getName());
}
}
@BeginTask @EndTask @Transition("to_test_completed")
public void runTest(){
log.debug("executing runTest");
if(processInstance != null){
log.debug(processInstance.getProcessDefinition().getName());
}
}
@CreateProcess(definition="Test Process 2")
public void start() {
log.debug("starting");
Actor actor = new Actor();
actor.setId(identity.getUsername());
log.debug(businessProcess.getProcessId());
jbpmContext.getJbpmConfiguration().getInstance();
}