1 Reply Latest reply on Sep 15, 2010 7:50 AM by mwohlf

    Create a new element for all nodes


      hi i would like to create a new element for all the nodes in jBPM4.4..which is similar to transition.ie i must be able to go from one node to another and one more new attribute in that element..

      Colud anyone plese tell me how to create a new element and how to add the element  in all the nodes.


      Thanks in advance


        • 1. Re: Create a new element for all nodes

          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...