4 Replies Latest reply on Jun 29, 2009 1:57 PM by sbhatti

    Best way to get audit or history information

      I am using Jbpm 3.2 and need to track an audit information for both manual and automated tasks. I saw that Jbpm 4.0 has history APIs but there are no such APIs for 3.2. Though, I saw that it might be possible to use JBPM_LOG table by enabling logging


      For each manual and automated step, I need to know
      - how it got to that step
      - start and end timestamp
      - the user who is assigned for manual tasks
      - context of the process, perhaps before and after

      Can someone suggest best way to get that information. I have not looked at JBPM_LOG schema, could it provide such information or is there a better way. Also, I saw some posts about size of JBPM_LOG that grows large. Is it going to be a problem. Thanks.

        • 1. Re: Best way to get audit or history information
          swatis

          in web console, you can get the information like number of process instances running, ended, suspended and so on... For each process instance tasks completed, running, assigned user, started date, ended date, etc. this information is available. i will give you piece of code to get the same information tomorrow morning. basically you need to fire queries to database to get the process instance information.

          • 2. Re: Best way to get audit or history information

            Let me know if you have any query APIs that I can use as from looking at the JBPM_LOG table, it seems like there are multiple rows per task transition and is not clear how to aggregate all that information for each transition. Thanks.

            • 3. Re: Best way to get audit or history information
              swatis

              to get list of process instances for particular process provide processdefinition id

              Query query = session.getNamedQuery("GraphSession.findAllProcessInstancesForADefinition");
               query.setLong("processDefinitionId", processDefinitionId);
               java.util.List processInstances = query.list();


              Iterate these instances and for one instance get list of task instances by invoking method of process instance object
              java.util.List taskList = processInstance.getTaskMgmtInstance().getTaskInstances();


              you can also use this query to get list of all process definitions
              Query query = session.getNamedQuery("GraphSession.findAllProcessDefinitions");


              to get list of all process instances
              Query query = session.getNamedQuery("GraphSession.findAllProcessInstances
              ");



              For each task instance use
              taskIns.getActorId(); taskIns.getStart(); taskIns.getEnd();



              • 4. Re: Best way to get audit or history information

                Thanks Swati for the code snippet, I will give it a try.