[jboss-user] [JBoss jBPM] - TaskInstance.setActorId(String) causes set TaskInstance to b

Octomac do-not-reply at jboss.com
Thu Jun 12 12:30:03 EDT 2008

I'm integrating jBoss jBPM with a JSF web application using a Glassfish server.

I'm having two issues with the setActorId method of the TaskInstance object.  For one, it seems that when I use this method to set a new Actor Id for a specified task, that task is rendered as closed (i.e. the ISCANCELLED flag in the TASKINSTANCE table is set to true).  Actually, all the boolean flags (canceled, suspended, open, etc.) are set to true, but I think the ISCANCELLED one is what's actually causing the tasks to fail to show up in the new task list.

The second problem I'm experiencing is that the changes I make to the list of tasks for my users do not seem to show up in the application until I redeploy it.  That is, I can see the changed ActorID in the database by quering it with an SQL tool, but until I redeploy the application, those changes are not reflected.  The reassigned task still appears in the "old" user's list.  I was under the impression that calling JbpmContext.save(TaskInstance); followed by JbpmContext.close(); would commit the changes to the database, which appears to be happening, but the next time I rebuild the list of tasks, JBPM continues to use the data that was pulled prior to saving the new task owner.

The code that I am using to perform the task reassignment is duplicated below.  If anyone can see any obvious reason why I might be experiencing these issues, please let me know.

This is the task assignment code in my JBPMController class, which holds all of my directly jBPM-related code.

  | public void assignTask(String taskId, String userId)
  | 	{
  | 		long taskInstanceId = Long.parseLong(taskId);
  | 		TaskInstance thisTask = jbpmContext.getTaskInstance(taskInstanceId);
  | 		thisTask.setActorId(userId);
  | 		jbpmContext.save(thisTask);
  | 	}

That code is called from my ProcessController class, a session bean in my JSF application.  Here is the calling function:

  | public String assignTask() throws SQLException, ClassNotFoundException{
  | 		try{
  | 			controller.openJbpmContext();
  | 			if(selectedTask != null && selectedTask != ""){
  | 				int taskId = Integer.parseInt(selectedTask);
  | 				controller.assignTask(selectedTask, uid);
  | 			}
  | 		}
  | 		finally{
  | 			controller.closeJbpmContext();
  | 		}
  | 		return("Set");
  | 	}

The openJbpmContext and closeJbpmContext methods above are part of the JBPMController class, and are there only to open and close the JbpmContext object in the Controller.  I've reproduced them here:

  | 	public void openJbpmContext()
  | 	{
  | 		jbpmContext = jbpmConfiguration.createJbpmContext();
  | 	}
  | 	public void closeJbpmContext()
  | 	{
  | 		jbpmContext.close();
  | 	}

I can't think of anything else in my code that is relevant to this problem, but if more information is required, I'll do my best to post it here.  If anyone has any ideas on why I might be experiencing the problems that I am, I would greatly appreciate your help!

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

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

More information about the jboss-user mailing list