Author: norman.richards(a)jboss.com
Date: 2008-05-08 14:25:52 -0400 (Thu, 08 May 2008)
New Revision: 8143
Modified:
trunk/src/main/org/jboss/seam/bpm/BusinessProcess.java
Log:
JBSEAM-2951
Modified: trunk/src/main/org/jboss/seam/bpm/BusinessProcess.java
===================================================================
--- trunk/src/main/org/jboss/seam/bpm/BusinessProcess.java 2008-05-08 16:50:53 UTC (rev
8142)
+++ trunk/src/main/org/jboss/seam/bpm/BusinessProcess.java 2008-05-08 18:25:52 UTC (rev
8143)
@@ -118,8 +118,7 @@
*/
public void createProcess(String processDefinitionName)
{
- ProcessInstance process =
ManagedJbpmContext.instance().newProcessInstanceForUpdate(processDefinitionName);
- afterCreateProcess(processDefinitionName, process);
+ createProcess(processDefinitionName, true);
}
/**
@@ -127,6 +126,18 @@
* current conversation.
*
* @param processDefinitionName the jBPM process definition name
+ */
+ public void createProcess(String processDefinitionName, boolean shouldSignalProcess)
+ {
+ ProcessInstance process =
ManagedJbpmContext.instance().newProcessInstanceForUpdate(processDefinitionName);
+ afterCreateProcess(processDefinitionName, process, shouldSignalProcess);
+ }
+
+ /**
+ * Create a process instance and associate it with the
+ * current conversation.
+ *
+ * @param processDefinitionName the jBPM process definition name
* @param businessKey the business key of the new process definition
*/
public void createProcess(String processDefinitionName, String businessKey)
@@ -136,15 +147,17 @@
.createProcessInstance(Collections.EMPTY_MAP, businessKey);*/
ProcessInstance process =
ManagedJbpmContext.instance().newProcessInstanceForUpdate(processDefinitionName);
process.setKey(businessKey);
- afterCreateProcess(processDefinitionName, process);
+ afterCreateProcess(processDefinitionName, process, true);
}
- private void afterCreateProcess(String processDefinitionName, ProcessInstance
process)
+ private void afterCreateProcess(String processDefinitionName, ProcessInstance process,
boolean shouldSignalProcess)
{
setProcessId( process.getId() );
// need to set process variables before the signal
Contexts.getBusinessProcessContext().flush();
- process.signal();
+ if (shouldSignalProcess) {
+ process.signal();
+ }
Events.instance().raiseEvent("org.jboss.seam.createProcess." +
processDefinitionName);
}