[jboss-user] [JBoss jBPM] - dynamically create tasks

AJanz do-not-reply at jboss.com
Fri Oct 3 09:37:17 EDT 2008


i got the following code to generate dynamically tasks on a node.


  | 			public Object execute(JbpmContext jbpmContext) throws Exception {
  | 				// TODO Auto-generated method stub
  | 						// TODO Auto-generated method stub
  | 
  | 					    Boolean b;
  | 					    try {
  | 							b = Boolean.TRUE;
  | 							ProcessInstance pi = jbpmContext
  | 									.loadProcessInstance(processid);
  | 							for (int i = 0; i < actors.size(); i++) {
  | 								String actor = (String) actors.get(i);
  | 								TaskInstance ti = pi.getTaskMgmtInstance()
  | 										.createTaskInstance();
  | 								ti.setActorId(actor);
  | 								jbpmContext.save(ti);
  | 							}
  | 							jbpmContext.save(pi);
  | 						} catch (Exception e) {
  | 							// TODO: handle exception
  | 							e.printStackTrace();
  | 							b= Boolean.FALSE;
  | 						}
  | 						return b;
  | 					}
  | 
  | 

sometimes i got a nullpointer exception on

TaskInstance ti = pi.getTaskMgmtInstance()

the processid is set correct.

any idea what might be wrong?




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

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



More information about the jboss-user mailing list