Kris Verlaenen [
https://community.jboss.org/people/KrisVerlaenen] created the discussion
"Re: How to get current node instance in a workitem handler?"
To view the discussion, visit:
https://community.jboss.org/message/729952#729952
--------------------------------------------------------------
Hi,
The main reason for not exposing the node instance in the work item handler is that
"in general" we believe this is not necessary in most use cases. Giving access
to the node instance in the handler would in a lot situations lead to handlers that are
tightly coupled to the process instance that triggered the service invocation (kinda like
how ActionHandlers worked in jBPM3), where they (imho) should be more generic and reusable
accross processes.
That said, I can see how access to the node instance id might be useful in some cases
(without losing the genericity of the handler). The work item currently has access to the
process instance id, so you could just retrieve the process instance from the session and
find the node instance that references this work item. We could make an
AbstractWorkItemHandler or a utility method that would allow you to do something like that
easily.
Wdyt?
Kris
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/729952#729952]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]