[jboss-user] [jBPM] - Re: getProcess in ProcessInstanceImpl throws a NullPointerException

Sandra Renaud do-not-reply at jboss.com
Fri Apr 5 07:52:16 EDT 2013


Sandra Renaud [https://community.jboss.org/people/joploya] created the discussion

"Re: getProcess in ProcessInstanceImpl throws a NullPointerException"

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

--------------------------------------------------------------
Lol, I'm looking forward to see your example about accessing metadatas!

To make the java code looks like java code, you must use the advanced editor :
click on add response
then click on advanced editor at right up corner outside the editing panel and accept to exit the page (normally your text is not remove).
finally select the code click on >> button and highlighting.

Easy compare to implement Jbpm!  :) 

If I can abuse a little more of your patience, I will explain you why I have to set process variable :
I use them to set the userId and groupId at each step for the next step. So I already use the parameter map when I start process :

Map<String, Object> variables = new HashMap<String, Object>();
                    variables.put("flowId", entity.getFlowId());
                    variables.put("flowType", entity.getFlowType().getFlowAcronym());
                    variables.put("codifType", codifType);
                    variables.put("groupAssign", codifType+"_P_ENG");
                    variables.put("userAssign", userAssign);
                    variables.put("line", line);
  
                    taskManager.startProcess("com.st.ams.flows.newfinishedgood", variables);

/**
           * Start a new processInstance of an existing Process
           * and set the variables of this instance
           * @param processId, map of variables
           * @return ProcessInstance created
           */
          public ProcessInstance startProcess(String processId, Map<String, Object> parameters){
                    ProcessInstance p = kSession.startProcess(processId,parameters);
                    return p;
          }


But one of my main targets using jbpm is to manage dynamic assignement, and I was starting doing this with the methode setVariables :

private void manageInstanceFgPlanStep2() {
                    log.debug("Normally this method is called after sending email : " + "it validate the step 2");
                    String userAssign = newFinishedGoodBean.getFlowEntity().getpEngPartEntity().getRecipientPoBeName();
                    log.debug(" ->userAssign = "+userAssign); 
                    taskManager.setProcessVariable(taskManager.getManageTask().getProcessInstanceId(), "userAssign", userAssign);
                    taskManager.setProcessVariable(taskManager.getManageTask().getProcessInstanceId(), "groupAssign", 
                                                                      "AMS_CRW_"+newFinishedGoodBean.getFlowEntity().getOrganisationalEntity().getCodifType()+"_PO_BE"); 
                    taskManager.completeTask(taskManager.getManageTask(),null); 
          }


This method to set variables worked very good until last week, I have test several flows from start to end... The major change I made is to persist session in database in order to retrive user task even if the application server crashes. So just one line :

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

replace by 
StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);


Are you a Jbpm developer? That must be awesome to take part to this project.
--------------------------------------------------------------

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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130405/40ed649a/attachment-0001.html 


More information about the jboss-user mailing list