[jboss-user] [JBoss jBPM] - Problem with update of variable value

vtysh do-not-reply at jboss.com
Wed Apr 18 02:28:28 EDT 2007


Sorry for my ugly english at first.

I can't decide my problem for a few days. I am working on web application similiar to native jbpm demo app.

I am using this code to load taskInstance and save variables (little simplified):


  | 	JbpmContext jbpmContext=null;
  | 	try
  | 	{
  | 		jbpmContext=createJbpmContext();
  | 		long taskId=0;
  | 		String taskIds=request.getParameter("taskId");
  | 		if(taskIds!=null)
  | 		{
  | 			try
  | 			{
  | 				taskId=Long.parseLong(taskIds);
  | 			}
  | 			catch(NumberFormatException e)
  | 			{						
  | 			}
  | 		}
  | 		TaskInstance taskInstance=jbpmContext.getTaskMgmtSession().loadTaskInstance(taskId);
  | 		List varAccesses=taskInstance.getTask().getTaskController().getVariableAccesses();
  | 		if(varAccesses!=null)
  | 		{
  | 			for(Iterator iter=varAccesses.iterator();iter.hasNext();)
  | 			{
  | 				VariableAccess varAccess=(VariableAccess)iter.next();
  | 				if(varAccess.isWritable())
  | 				{
  | 					String name=varAccess.getVariableName();
  | 					String value=pRequest.getParameter(name);
  | 					if(value==null||value.length()==0)
  | 					{
  | 						if(varAccess.isRequired())
  | 						{
  | 							throw new UserError("parameter_required");
  | 						}
  | 					}
  | 					else
  | 					{
  | 						taskInstance.setVariable(name,value);
  | 					}
  | 				}
  | 			}
  | 		}
  | 		//marker 1
  | 		taskInstance.end(request.getParameter("transition"));
  | 		//marker 2
  | 	}
  | 	finally
  | 	{
  | 		jbpmContext.close();
  | 	}
  | 

Before line marked as "marker 1" all seems to be ok, variable updates theirs values, if i display it to System.out i see, that values is changed. But after i end task instance if variable was setted before, in some earlier task, then it backs old value again. 
For example: variable "test" has value "first value" which was setted in some previouse task node. In current task node i am trying to update it to "second value" all seems to be good until i end task node. Before i end it i have a "second value" as a value of variable "test", but after i end task value returns to previous one and has "first value" as a value.

Please explain what am i doing wrong?

Thank you.

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

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



More information about the jboss-user mailing list