2 Replies Latest reply on Sep 2, 2014 8:16 AM by mdegan

    how can i get all the processIds in jbpm5.3

    其凡 莫 Newbie

      i try to use ksesson.getProcessInstaces(); but it return a collecion of size 0 which confused ne a lot

        • 2. Re: how can i get all the processIds in jbpm5.3
          mdegan Newbie

          Hi,

           

          Do you need processIds or ProcessIntanceIds. These are 2 different things. ProcessIds are the Ids of the processes however each instance of the process will have a ProcessInstanceId. So if there are 2 processes in your system, you will have 2 processIds and if there are 10 instances of each process running, you will have 20 processInstances working in your engine, 10 for each processId.

           

          If you need process information available in the system, you can query the ksession for them. You can get all available process Ids as:

           

          Iterator<org.drools.definition.process.Process> it = kSession.getKnowledgeBase().getProcesses().iterator();

           

            while(it.hasNext())

            {

               it.next().getId();

          }

           

          If you want all processInstances for a specific processId in the system, you can do so by using the DB Logger by using the following line in the while loop instead of the line which is there now and iterate these to get the information on each process instance.

          List<ProcessInstanceLog> pl = JPAProcessInstanceDbLog.findProcessInstances(it.next().getId());

           

          Regards,

          Manny