Hello all. I am using the Activiti-CDI module, a CDI observer, @Observes BusinessProcessEvent businessProcessEvent. All of that is working perfectly. I would like to be able to run some code when a ProcessInstance is started or before it's destroyed. I've been trying to figure out a way to see what node type the BusinessProcessEvent is at, for example a Start Event or an End Event, but have been unable to do so. Any pointers on how I can do that?
I tried to inject the Task, as per the manual, using @Inject Task task, to see if I could get the current node from that, Now I get the error <code> Servlet.service() for servlet Faces Servlet threw exception: org.activiti.cdi.ActivitiCdiException: Cannot work with tasks in an activiti command. at org.activiti.cdi.impl.context.DefaultContextAssociationManager.getTask(DefaultContextAssociationManager.java:235) [activiti-cdi-5.13.jar:] at org.activiti.cdi.BusinessProcess.getTask(BusinessProcess.java:467) [activiti-cdi-5.13.jar:] at org.activiti.cdi.CurrentProcessInstance.getTask(CurrentProcessInstance.java:99) [activiti-cdi-5.13.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_32] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_32] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_32] </code>