Implement EventHandler for pre/after/post processes
Description
Environment
Activity

Hiep Lq March 23, 2019 at 12:35 AM
example: i want to handle that event for jasper report only case ReportStart is called. in case other implement called i want to implement handle a bit different
Carlos Ruiz March 22, 2019 at 2:40 PM
Hi ,
ProcessFactory can return a different class, but is always based on the classname registered in dictionary.
So, I think you normally want to add the EventHandler to the registered class, not to your custom class.
Which would be the use case?
Regards,
Carlos Ruiz

Hiep Lq March 22, 2019 at 2:08 AM
i love to have
Event event = EventManager.newEvent(topic,
new EventProperty(EventManager.EVENT_DATA, m_pi),
new EventProperty("processUUID", m_pi.getAD_Process_UU()),
new EventProperty("className", m_pi.getClassName()),
new EventProperty("processClassName", this.getClass().getName())
);
because process factory can return any process, i want to know which class i add my handle

Nikita Polkovnikov March 21, 2019 at 9:19 PMEdited
please see discussion Bug: EventHandler is not thread safe
Carlos Ruiz March 21, 2019 at 1:29 AM
Committed 197191b
Sample code for the EventHandler:
The Event can be registered using UUID or classname:
To implement pre/after/post routines on core processes is possible at this moment to extend the class and override the methods prepare/doIt/postProcess.
But that's not always possible as not all processes are exposed to plugins, and also in some cases it can be necessary that several plugins capture the same process.
So, this ticket is to improve extensibility by implementing events for:
pre-process - after prepare, before doIt
after-process - after doIt, before commit
post-process - after commit