[jboss-user] [jBPM Users] - Re: how to get all tokens from processinstance

saraswati.santanu do-not-reply at jboss.com
Mon Nov 9 07:20:34 EST 2009


LoggingInstance is not persisted. So you cannot really get the history data from it after the transaction is over. For that you need LoggingSession. If you are saving the logs then you can get the information using LoggingSession.


  | //create a LoggingSession. getSession() here returns a Hibernate session
  | LoggingSession logginSession = new LoggingSession(getSession());
  | 
  | //this map contains Token vs List of logs
  | Map logs = logginSession.findLogsByProcessInstance(processInstance.getId());
  | 
  | //Iterate and do whaterver you need to
  | Set<Entry> entries = logs.entrySet();
  | for (Entry entry : entries) {
  |     List<ProcessLog> processLogs = (List<ProcessLog>)entry.getValue();
  |     for (ProcessLog log:processLogs) {
  | 	System.out.println("Log type : " + log.getClass().getSimpleName());
  |     }
  | }
  | 

So far I remember, along with the code above, you need to call 

  |     jbpmContext.save(processInstance);
  | 
everytime after you do the signalling/task execution. This call saves the logs in db.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264558#4264558

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264558



More information about the jboss-user mailing list