[jboss-user] [JBoss jBPM] - Re: Modeling simple process(tasks)

dlipski do-not-reply at jboss.com
Wed Jul 19 09:30:14 EDT 2006


This was my mistake I used this attributes in  not in <task-node>.

At the end I found solution for my problem:
mapping fragment:


  | <task-node name="proposed" end-tasks="true" signal="never">
  | 	<task name="accept">
  | 	<assignment class="orders.workflow.OrdersAssignmentHandler"/>
  | 	</task>
  | 	<task name="cancel">
  | 	<assignment class="orders.workflow.OrdersAssignmentHandler"/>
  | 	</task>
  | 	<transition name="accept" to="accepted"></transition>
  | 	<transition name="cancel" to="canceled"></transition>
  | </task-node>
  | 

Listing avaliable actions for user:

Map<ProcessInstance, List<TaskInstance>> instancesGrouped = new HashMap<ProcessInstance, List<TaskInstance>>();
  | for(TaskInstance task : tasks)
  | {
  | 	ProcessInstance process = task.getToken().getProcessInstance();
  | 	List<TaskInstance> instances = instancesGrouped.get(process);
  | 	if(instances == null)
  | 	{
  | 		instances = new ArrayList<TaskInstance>();
  | 		instancesGrouped.put(process,instances);
  | 	}
  | 	instances.add(task);		
  | }
  | 

After task performing:



  | JbpmContext ctx = workflowConfig.createJbpmContext();
  | TaskInstance task = ctx.loadTaskInstance(taskId);
  | Token token = task.getToken();
  | task.end();
  | token.signal(task.getName());
  | ctx.save(token);
  | ctx.close();
  | 

This solution is generic, modyfing process doesn't force any changes in the client code, whats more adding new tasks requires only adding code for handling this tasks. Of course i need some mapping between task names and Java code (displaying some special UI forms) but this is obvious (for me).

I'm gratefull for any comments.

Regards

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

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



More information about the jboss-user mailing list