07-26-2013 02:38 AM
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
…
<property name="preBpmnParseHandlers">
<list>
<bean class="com.testowy.test.TestBpmnParseHandler" />
</list>
</property>
…
</bean>
public class TestBpmnParseHandler implements BpmnParseHandler {
//…
@Override
public void parse(BpmnParse bpmnParse, BaseElement element) {
//…
ExtensionElement ee = new ExtensionElement();
ee.setNamespacePrefix("activiti");
ee.setName("taskListener");
ExtensionAttribute ea = new ExtensionAttribute();
ea.setName("event");
ea.setValue("complete");
ee.addAttribute(ea);
ExtensionAttribute ea2 = new ExtensionAttribute();
ea2.setName("class");
ea2.setValue("com.testowy.common.AOTaskListener");
ee.addAttribute(ea2);
element.addExtensionElement(ee);
//…
}
//…
}
08-01-2013 08:30 AM
06-21-2017 02:12 PM
I tried adding a parse handler following the above example, but ((ProcessDefinitionEntity) bpmnParsegetCurrentScope().getProcessDefinition()).getTaskDefinitions() is an empty hash table. I tried both pre and postBpmnParseHandlers.
What am I doing wrong?
06-23-2017 03:37 PM
It seems that ((ProcessDefinitionEntity) bpmnParsegetCurrentScope().getProcessDefinition()).getTaskDefinitions() is non-empty only for User Tasks. For Service and Script Tasks, it is an empty collection.
What will be the best way to attach a listener to all task nodes in a process definition at parsing time?
06-20-2017 05:24 AM
Hello,
currently I am working on the transformation of the old BpmnParseListeners to the BpmnParseHandlers.
I was facing a similar problem, that is how can I add ExecutionListeners to certain tasks and processes? I found your example here in the forum and tried to do it like that, but the BpmnParse is empty and it's currrentXXX members are null.
protected void executeParse(BpmnParse bpmnParse, Process element) {
for (IConfigurableExecutionListener listener : m_executionListeners) {
if (listener.supportsProcess()) {
bpmnParse.getCurrentProcessDefinition().addExecutionListener(listener.supportedEvent(), listener);
}
}
}
What did I do wrong?
I added the parse handler to the "preBpmnParseHandlers".
I use Activiti 5.22.0
Do you have some more detailed examples how to do the transformation from ParseListeners to ParseHandlers? Actually I am not sure how to use the parameters BpmnParse and Element correctly.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.