2 Replies Latest reply on Jun 26, 2006 6:05 PM by hosierdm

    getting process history

    tmarafon

      How can I know which people participated in a process?
      When did they do the tasks?
      How long did they take for it?

      thanks...

      Thiago

        • 1. Re: getting process history
          hosierdm

          Check out the LoggingSession class in the javadocs and look at this section in the User Guide:
          http://docs.jboss.org/jbpm/v3/userguide/logging.html. It's not much, but it's a start. You can get a Map that contains the set of logs for each token. Each entry in the map is for a token, therefore, any simple process will only have one entry. You can retrieve that entry, which will return a List containing a bunch of log events. There are different classes for different log events, so you basically need to determine which log type an entry is, and that will dictate which information you can get from that log entry. Here is a simple little method I wrote that will loop through a process instance's logs and print out some info about each entry.

          JbpmContext context = JbpmConfiguration.getInstance().createJbpmContext();
          try
          {
           Map processLogs =
           context.getLoggingSession().findLogsByProcessInstance(processInstanceId);
          
           for (Iterator it = processLogs.keySet().iterator(); it.hasNext(); )
           {
           Object tokenLogKey = it.next();
           System.out.println("Loading Logs for Token: " + tokenLogKey);
           List logList = (List)processLogs.get(tokenLogKey);
           for (Iterator it2 = logList.iterator(); it2.hasNext(); )
           {
           Object logEntry = it2.next();
           System.out.println("LOG TYPE: " + logEntry.getClass().getName() + " --> " + logEntry.toString());
           }
           }
          }
          finally
          {
           context.close();
          }
          


          The above code is commented out in some class that I have, so I haven't used it in a while, but it should work. If it doesn't, at least you should get the point.

          • 2. Re: getting process history
            hosierdm

            Plus, you could have searched and found the following post that I just rememberd making on this exact topic:
            http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3942962