Discussion:
[jboss-user] [jBPM] - JBPM 5.4.0-Final: Human Task variables mapping persistence problem.
maq99
2013-01-23 07:52:11 UTC
Permalink
maq99 [https://community.jboss.org/people/maq99] created the discussion

"JBPM 5.4.0-Final: Human Task variables mapping persistence problem."

To view the discussion, visit: https://community.jboss.org/message/793685#793685

--------------------------------------------------------------
Hallo,

I have try to get help in simmilar topic https://community.jboss.org/thread/218281?start=15&tstart=0 https://community.jboss.org/thread/218281?start=15&tstart=0 but withou success. So I decide to create new one.
My problem is that I cannot get access to process variable set as a result in HumanTask1 from HumanTask2
This is my diagram:
Loading Image... Loading Image...
Short flow description:
After process is started user:user1 pick object:wrapper (from external Wsdl) to edit, chenge its fields and confirm changes or reject it.
Eddited object is about to be placed as HT result and stored as process variables.
First gateway check if object have been placed (not null - go to commit) or changes have been rejected (is null - cancel & end process)
At begininig next HT (approval) log script is called, then it calls my custom EscalatedDeadlineHandler and send email to user:approver (HT2 task owner).
Approval base on object:wrapper from previous HT. Approval page display edited object:wrapper and shows changes made by user:user1
As a result Boolean value isApproved has to be added to proces variables. Next gateway check isApproved = true then go to submit changes (send back to store edited object - external Wsdl) - else goes to end.

Process is started correctly but I cannot see variables added at HT1 in database.
I also have problem with load/ reload disposed session.

I have seen and try:
http://stackoverflow.com/questions/7120600/completing-a-task-fails-after-calling-statefulsession-dispose http://stackoverflow.com/questions/7120600/completing-a-task-fails-after-calling-statefulsession-dispose
https://community.jboss.org/thread/201901 https://community.jboss.org/thread/201901
https://community.jboss.org/thread/171181 https://community.jboss.org/thread/171181
https://community.jboss.org/message/745526#745526 https://community.jboss.org/message/745526
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-persistence-jpa/src/test/java/org/jbpm/persistence/session/VariablePersistenceStrategyTest.java https://github.com/droolsjbpm/jbpm/blob/master/jbpm-persistence-jpa/src/test/java/org/jbpm/persistence/session/VariablePersistenceStrategyTest.java
(try both strategies - i prefer to store serializable object but tested entity object to - object have been persisted - but i have not found reference to it in db process data)

Below test project sources can be found. Project base on Seam2.2 - required libs list (not attached) can be found in deployed-jars-ear.list & deployed-jars-war.list files
I have changed data source name at persistence. Project use Jboss7.1.3 with deployed jbpm-human-task-war-5.4.0.Final-EE6.war (also with changed DS name)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/793685#793685]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
maq99
2013-02-15 09:15:59 UTC
Permalink
maq99 [https://community.jboss.org/people/maq99] created the discussion

"Re: JBPM 5.4.0-Final: Human Task variables mapping persistence problem."

To view the discussion, visit: https://community.jboss.org/message/797834#797834

--------------------------------------------------------------
Workaround for this problem - get variable at HT2 from task contetnt :

public Object getProcessParameter(Long taskId, String key){

     TaskService taskService = getLocalTaskService();
     Task task = taskService.getTask(taskId);
     TaskData taskData = task.getTaskData();
     Long documentContentId = taskData.getDocumentContentId();
     Content content = taskService.getContent(documentContentId);
     Map<?, ?> variableMap = ((Map<?, ?>) ContentMarshallerHelper.unmarshall(content.getContent(), null));
     retObj = variableMap.get(key);
}

I don't know why it is not available as process variable.
Regards
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797834#797834]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Sandra Renaud
2013-02-15 14:09:19 UTC
Permalink
Sandra Renaud [https://community.jboss.org/people/joploya] created the discussion

"Re: JBPM 5.4.0-Final: Human Task variables mapping persistence problem."

To view the discussion, visit: https://community.jboss.org/message/797918#797918

--------------------------------------------------------------
Hello,
/**
           * Return the WorkflowProcessInstance associated to a Task
           * This instance allow to access the map of variables
           */
          public WorkflowProcessInstance getWorkflowProcessInstance(long processInstanceId){
                    return (WorkflowProcessInstance)kSession.getProcessInstance(processInstanceId);
          }
kSession is a StatefullKnowledgeSession

then you access your process variable like this : getWorkflowProcessInstance(task.getProcessInstanceId()).getVariable("formObject");

Regards,
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797918#797918]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
maq99
2013-02-18 08:51:34 UTC
Permalink
maq99 [https://community.jboss.org/people/maq99] created the discussion

"Re: JBPM 5.4.0-Final: Human Task variables mapping persistence problem."

To view the discussion, visit: https://community.jboss.org/message/798123#798123

--------------------------------------------------------------
Sorry but You have not seen the attachment code.. the problem exist because at HT2 i have null variable aldow it have been set at HT1.. full code of getProcessParameter is:
public Object getProcessParameter(StatefulKnowledgeSession ksession,                Long processInstanceId, Long taskId, String key) {                      String paramInfo = "getProcessParameter sessionid: " + ksession.getId() + ","                     + ksession.hashCode() + " processInstanceId: "                     + processInstanceId + " taskId: "+taskId;           WorkflowProcessInstance workflowProcessInstance = (WorkflowProcessInstance) ksession                     .getProcessInstance(processInstanceId);           Object retObj = null;                      if (workflowProcessInstance == null                     || workflowProcessInstance.getVariable(key) == null) {                                 TaskService taskService = getLocalTaskService();                Task task = taskService.getTask(taskId);                TaskData taskData = task.getTaskData();                Long documentContentId = taskData.getDocumentContentId();                Content content = taskService.getContent(documentContentId);                Map variableMap = ((Map) ContentMarshallerHelper                          .unmarshall(content.getContent(), null));                retObj = variableMap.get(key);                 par
maq99
2013-02-19 15:07:13 UTC
Permalink
maq99 [https://community.jboss.org/people/maq99] created the discussion

"Re: JBPM 5.4.0-Final: Human Task variables mapping persistence problem."

To view the discussion, visit: https://community.jboss.org/message/798361#798361

--------------------------------------------------------------
To run the flow after reload session i made this: https://community.jboss.org/message/759786#759786 https://community.jboss.org/message/759786
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/798361#798361]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...