[jboss-user] [JBoss jBPM] - Problem creating Process Instance and Tasks

jmjava do-not-reply at jboss.com
Tue Aug 29 09:52:41 EDT 2006


I am trying to creat a simple web application that demonstrates moving a token through a process and assigning users to tasks during the process.  

I am using the Spring Modules package  to configure my JBPM engine.   When i try to create a processInstance and signal the token it appears that my Taskinstance is not getting creating for my first task.

Here is my simple process Definition:

<?xml version="1.0" encoding="UTF-8"?>

<process-definition name="3step">

  <!-- START-STATE -->
  <start-state name="start">
      
  </start-state>

  <!-- NODES -->
  <end-state name="end"/>
   <task-node name="task1">
      
   </task-node>
   <task-node name="task2">
      
   </task-node>
   <task-node name="task3">
      
   </task-node>

</process-definition>


Here is the code in my servlet:

webContext = WebApplicationContextUtils
				.getRequiredWebApplicationContext(getServletContext());

		jbpmConfiguration = (JbpmConfiguration) webContext
				.getBean("jbpmConfiguration");

		JbpmTemplate jbpmTemplate = (JbpmTemplate) webContext
				.getBean("jbpmTemplate");


		
		ProcessDefinition pd = jbpmTemplate.getProcessDefinition();				
		

		ProcessInstance processInstance = new ProcessInstance(pd);

		Token token = processInstance.getRootToken();
		
		token.signal();
		
		TaskInstance task1 = getTaskInstanceByTaskName(processInstance, "task1");
		task1.setActorId("me");

.........


private TaskInstance getTaskInstanceByTaskName(ProcessInstance processInstance, String taskName){
		
		 Collection taskInstances = processInstance
         .getTaskMgmtInstance()
         .getTaskInstances();  // this collection is always null????	 
	 
	 Iterator i = taskInstances.iterator();
	 
	 TaskInstance currentTask = null;
	 
	 while (i.hasNext()){
		 TaskInstance task = (TaskInstance)i.next();
		 
		 if (task.getName().equals(taskName)){
			 currentTask = task;
			 break;
		 }			 
	 }
	 
	 return currentTask;
		
		
	}

Can anyone shed some light on why there is no task instance for this processInstance after the token.signal() is processed?

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

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



More information about the jboss-user mailing list