[jboss-user] [JBoss jBPM] - Problem with transition

roberto do-not-reply at jboss.com
Thu Sep 25 11:37:56 EDT 2008


I'm rewriting a Web User Interface for JBpm to integrate it on my own application.

I have some problem using transition API

I have a definition like this:

  | 	<start-state name="Submit-SalesOrder">
  | 		<description>
  | 			Sales Order General
  | 		</description>
  | 		<task name="SalesOrder" swimlane="DataEntry">
  | 			<description>
  | 				Sales Order task
  | 			</description>
  | 			<controller>
  | 				<variable access="read,write,required" name="Field1" mapped-name="Field1"></variable>
  | 			</controller>
  | 		</task>
  | 		<transition to="Evaluate_Order" name="Start"></transition>
  | 	</start-state>
  | 
  | 
  | 	<task-node name="Evaluate_Order">
  | 		<description>
  | 			Evaluate Order General
  | 		</description>
  | 		<task blocking="true" name="Approve" swimlane="CountryManager">
  | 			<description>
  | 				Approve Task
  | 			</description>
  | 			<controller>
  | 				<variable access="read,write" name="AdditionalDiscount" mapped-name="Additional Discount"></variable>
  | 			</controller>
  | 		</task>
  | 		<transition to="Place-Order" name="Yes">
  | 			<description>
  | 				yes! I Approve It
  | 			</description>
  | 		</transition>
  | 		<transition to="WhyNot" name="No">
  | 			<description>
  | 				No! I discart It
  | 			</description>
  | 		</transition>
  | 	</task-node>
  | 
  | 	<task-node name="WhyNot">
  | 		<task blocking="true" swimlane="CountryManager">
  | 			<controller>
  | 				<variable access="read,write" name="Comment" mapped-name="Comment"></variable>
  | 			</controller>
  | 		</task>
  | 		<transition to="ChangeBlock-CloseOrder" name="CloseOrder"></transition>
  | 	</task-node>
  | ...
  | 


I my java code i can create successful the process instance

  | ...
  |       JbpmContext vJbpmContext = getJbpmContext();
  |       try
  |       {
  |          ProcessInstance vProcessInstance = vJbpmContext.newProcessInstanceForUpdate(aProcessDefinitionName);
  |          vProcessInstanceId = vProcessInstance.getId();
  |          ContextInstance vContextInstance = vProcessInstance.getContextInstance();
  |          Token vToken = vProcessInstance.getRootToken();
  |          vToken.signal();
  |       }
  |       finally
  |       {
  |          closeContext(vJbpmContext);
  |       }
  | ...
  | 

I can retrieve transition from task instance...  but when I try to "invoke" the transition

  | ...
  |          vTaskInstance = vJbpmContext.getTaskInstance(vTaskId);
  |          if (vTaskInstance.isBlocking())
  |          {
  |             if (vTaskInstance.getStart() == null)
  |                vTaskInstance.start();
  |             if (vTaskInstance.getEnd() == null)
  |                vTaskInstance.end();
  |          }
  |          vTaskInstance.getToken().signal("Yes"); // or also ("No")
  | ...
  | 
The signa is sent to the default transition and I recieve an exception that says "transition doesnt exists on WhyNot task.... "

I believe I dont' know exactly the correct flow.

Can someone help me ?
Or where I can found a simple example how to manage it?
thanks


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

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



More information about the jboss-user mailing list