1 2 Previous Next 19 Replies Latest reply on Apr 26, 2014 4:31 AM by mm524262909 Go to original post
      • 15. Re: getProcess in ProcessInstanceImpl throws a NullPointerException
        joploya

        Hello Marco,

         

        I use Jboss 7.

         

        These are two bpmn2 files : first is a complete flow with dynamic assignation, and the second is a flow with a single human node but also with dynamic userId.

         

        I look at your POM example for the branch 5.4, you don't use context injection? I use it, but if I can give you other files to help you make your example, no problem.

        • 16. Re: getProcess in ProcessInstanceImpl throws a NullPointerException
          joploya

          Finally, I set the assignation and other dynamic variable with outputparameters.

           

          First I encounter a runtime exception but it was due to mySQL who creates all foreihn keys with restric cascading and prevent jbpm from updating task parameters.

          I just change the cascading type directly in the database and now it's works fine.

           

          resultMapping.png

           

          In the step validation (java code):

           

          Map<String, Object> results = new HashMap<>();
                              results.put("userAssign", userAssign);
                              results.put("groupAssign", groupAssign);
                              results.put("formValid", formValid);
            
                              taskManager.completeTask(taskManager.getManageTask(),results);
          

           

          Thank you very much again Marco!

          • 17. Re: getProcess in ProcessInstanceImpl throws a NullPointerException
            bird86

            http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e2102

            you see the chapter of 6.8.1.Data

            xxx.png

             

            it may be the reason of throws a NullPointerException. it is important, you use or dont use persistence.

            • 18. Re: getProcess in ProcessInstanceImpl throws a NullPointerException
              joploya

              Hello,

               

              Thank you for the link. Indeed, when I don't use persistence I just used the workflowProcessInstance and it works great. And the NullPointerException apear after changing to persistent session.

               

              But, I already try the command base approach and in my case it doesn't change anything. 

               

              My conclusion that seams to work for now is :

              WorkflowProcessInstance wpi = (WorkflowProcessInstance)kSession.getProcessInstance(processInstanceId);
               wpi.getVariable(key);
              

              to access variables even if I use persistent session.

               

              and define output parameters mapped to process variables directly inside the process and pass a map of results to the complete task method to dynamically change process variables.

              • 19. Re: getProcess in ProcessInstanceImpl throws a NullPointerException
                mm524262909

                hei , i want to see in a process which node is active and which node is completed to monitor the process

                but when i use a method someone suggest below

                     public List<String> getActiveNodes(Long processInstanceId){

                        ProcessInstance instance = ksession.getProcessInstance(processInstanceId);

                        WorkflowProcessInstance wfInstance = ((WorkflowProcessInstance)instance);  

                       // get current active Node names

                       List<String> activeNodes = new ArrayList<String>();

                       getActiveNodes(wfInstance,activeNodes);

                      return activeNodes;

                    }

                 

                    private void getActiveNodes(NodeInstanceContainer container, List<String> activeNodes) { 

                        for (NodeInstance nodeInstance: container.getNodeInstances()) {

                          activeNodes.add(nodeInstance.getNodeName());

                          if (nodeInstance instanceof NodeInstanceContainer) {

                             getActiveNodes((NodeInstanceContainer) nodeInstance, activeNodes);

                          }

                        }

                    }

                a nullpointer exception happans

                 

                ,can jbpm5 generate a image that represent the current state of the process , not only the image we draw in bpmn2 but also the state of which node is completed and reserved .

                1 2 Previous Next