[jboss-user] [jBPM Users] - Re: JBPM 4.0 HistoryEvent, HistorySession

tcr do-not-reply at jboss.com
Mon Sep 21 07:15:36 EDT 2009


Addition:
I wasn't able to find a binding for HistorySessionChain. I created one (see below). 

Maybe some hints for all who want to add a custom historySession....

Steps:

- Create your custom history Session (implement org.jbpm.pvm.internal.history.HistorySession)
- Create the binding class for the custom history session (you can copy the binding from historySession and adjust tag and class)
- Create the binding class for the historySessionChain (see below)
- Add both bindings to jbpm.wire.bindings.xml
- Change your configuration by adding the chain-tag including the actual history sessions.

Last problem I have:
Can anyone see an option to get the of the execution memeber of the history-events in the custom event session without changing the code?


Regards
Torsten


CustomHistorySession.java

package com.test;
  | 
  | public class CustomHistorySession implements HistorySession {
  | 	public void process(HistoryEvent historyEvent) {
  | 		// Do your custom work here
  | 	}
  | }

CustomHistorySessionBinding.java

  | package com.test;
  | public class CustomHistorySessionBinding extends WireDescriptorBinding {
  | 
  |   public  CustomHistorySessionBinding() {
  |     super("custom-history-session");
  |   }
  | 
  |   public Object parse(Element element, Parse parse, Parser parser) {
  |     return new ObjectDescriptor(CustomHistorySession.class);
  |   }
  | }

HistorySessionChainBinding.java (copy and modify from deployer-manager)

  | package com.test;
  | 
  | public class HistorySessionChainBinding extends WireDescriptorBinding {
  |   
  | 	private static final String HISTORY_SESSION_CHAIN_TAG = "history-session-chain";
  | 	  
  | 	  public HistorySessionChainBinding() {
  | 	    super(HISTORY_SESSION_CHAIN_TAG);
  | 	  }
  | 
  |   public Object parse(Element element, Parse parse, Parser parser) {
  |     ObjectDescriptor objectDescriptor = new ObjectDescriptor(HistorySessionChain.class);
  |     
  |     ListBinding listBinding = new ListBinding();
  |     ListDescriptor listDescriptor = (ListDescriptor) listBinding.parse(element, parse, parser);
  |     objectDescriptor.addInjection("delegates", listDescriptor);
  | 
  |     return objectDescriptor;
  |   }
  | }


jbpm.wire.bindings.xml

  | <binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
  |   <binding class="com.test.HistorySessionChainBinding" />
  |   <binding class="com.test.CustomHistorySessionBinding" />
  | 

jbpm.cfg.xml

  | <transaction-context>
  | [...]
  | 	<history-session-chain >
  |     		<history-session />
  |     		<custom-history-session />
  |     	</history-session-chain>
  | [...]
  | </transaction-context>




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

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



More information about the jboss-user mailing list