[jboss-user] [jBPM] - Re: Create a new element for all nodes

Michael Wohlfart do-not-reply at jboss.com
Wed Sep 15 07:50:55 EDT 2010

Michael Wohlfart [http://community.jboss.org/people/mwohlf] created the discussion

"Re: Create a new element for all nodes"

To view the discussion, visit: http://community.jboss.org/message/561954#561954

I have a similar requirement for my project, this is what i learned, if someone has some better ideas please let me know...

You can roll your own "nodes" in jBPM by providing your own binding, this means extend JpdlBinding and return an instance of ExternalActivityBehaviour in parseJpdl() (check the source of TaskBinding to see how it is done). To get your nodes parsed you have to add your binding to jbpm.user.bindings.xml in the root of your classpath (check jbpm.jpdl.bindings.xml for the format).
Transition are special in the sense that there are is no binding for them, they are parsed directly in the JpdlParser, in order to customize transition you need to customize the parser I think.
However you can add your custom eventlistener to a transition, so I abused an empty eventlistener to get some attributes for my transition. I have a class called TransitionConfig that extends EventListener, TransitionConfig has a custom binding and just an empty notify() method.Getting the config data for a transition is a bit tricky:

final EventImpl event = transition.getEvent(Event.TAKE);
final List<EventListenerReference> listeners = event.getListenerReferences(); 
 if (listeners != null) {
   for (final EventListenerReference reference : listeners) {
     final EventListener listener = reference.getEventListener();
     if (listener instanceof TransitionConfig) {
       transitionConfig = (TransitionConfig) listener;

so I admit using an event listener to keep some config data is butt ugly and I am sure i will burn in hell for that, but hacking the parser might be even more tricky, i am open for suggestions...

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100915/20498256/attachment.html 

More information about the jboss-user mailing list