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;
break;
}
}
}
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
[
http://community.jboss.org/message/561954#561954]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]