[jboss-user] [JBoss jBPM] - Automate Workflow Steps

ashishc do-not-reply at jboss.com
Mon Jul 7 15:03:52 EDT 2008


Hi All,
I have create a simple workflow which has 2 nodes, a start state and an end state. Here is the source...

<?xml version="1.0" encoding="UTF-8"?>
  | 
  | <process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="http-demo-process">
  | <swimlane name="initiator">
  | 		<assignment actor-id="manager" />
  | 	</swimlane>
  | 
  | 	<start-state name="start">
  | 		<transition to="call action"></transition>
  | 	</start-state>
  | 	
  | 	<node name="call action">
  | 			<action class="com.sample.action.MessageActionHandler">
  | 			<message>First Message</message>
  | 		</action>
  | 			<transition to="post data"></transition>
  | 	</node>
  | 	<node name="post data">
  | 		<action class="com.sample.action.PostActionHandler">
  | 			<message>First Message</message>
  | 			</action>
  | 		<transition to="end"></transition>
  | 	</node>
  | 	<end-state name="end"></end-state>
  | </process-definition>

Now after I deploy, in the  jbpm-console, I have to click to start the workflow and then at every step I have to click start-end to finally reach the end of the workflow.

Is there someway I can automate the entire process?? 

Here is the action class for the node above:

package com.sample.action;
  | 
  | import org.jbpm.graph.def.ActionHandler;
  | import org.jbpm.graph.exe.ExecutionContext;
  | import org.apache.commons.logging.Log;
  | import org.apache.commons.logging.LogFactory;
  | 
  | public class MessageActionHandler implements ActionHandler {
  | 
  | 	Log log = LogFactory.getLog(this.getClass());
  | 	private static final long serialVersionUID = 1L;
  | 	
  | 	/**
  | 	 * The message member gets its value from the configuration in the 
  | 	 * process definition. The value is injected directly by the engine. 
  | 	 */
  | 	String message;
  | 
  | 	/**
  | 	 * A message process variable is assigned the value of the message
  | 	 * member. The process variable is created if it doesn't exist yet.
  | 	 */
  | 	public void execute(ExecutionContext context) throws Exception {
  | 		context.getContextInstance().setVariable("message", message);
  | 		log.info("Printing Message at end: " + message);
  | 		//context.leaveNode();
  | 		String taskName = context.getTaskInstance().getName();
  | 		log.info("taask name  " + taskName);
  | 		
  | 	}
  | 
  | }

What I want to do is start the workflow and then it goes through all the steps and reaches end. 

Also whats the best way to pass data (or values) from one step to another in the jbpm Workflow.

Please advise.

Thanks
Ashish

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4162932#4162932

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4162932



More information about the jboss-user mailing list