Manipulating BPMNs programmatically prior to deployment
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2013 12:29 PM
Hi,
I have a bytestream of BPMN and i'm looking to add an activiti listener on the end event just prior to deployment.
Is there any API of activiti I can use to add such listener to the process? Perhaps one that parses the BPMN to a POJO I can then traverse and manipulate by adding elements just before deployment?
Thanks.
I have a bytestream of BPMN and i'm looking to add an activiti listener on the end event just prior to deployment.
Is there any API of activiti I can use to add such listener to the process? Perhaps one that parses the BPMN to a POJO I can then traverse and manipulate by adding elements just before deployment?
Thanks.
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2013 04:42 PM
Figured it out:
public class ProcessWithEndEventParseListener extends ProcessParseHandler {
@Override
protected void executeParse(BpmnParse bpmnParse, org.activiti.bpmn.model.Process process) {
ActivitiListener endEventListener = new ActivitiListener();
endEventListener.setEvent(ExecutionListener.EVENTNAME_END);
endEventListener.setImplementation(MyEndEventExecutionListener.class.getName());
endEventListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
process.setExecutionListeners(Lists.newArrayList(endEventListener));
}
}
worked like a charm
public class ProcessWithEndEventParseListener extends ProcessParseHandler {
@Override
protected void executeParse(BpmnParse bpmnParse, org.activiti.bpmn.model.Process process) {
ActivitiListener endEventListener = new ActivitiListener();
endEventListener.setEvent(ExecutionListener.EVENTNAME_END);
endEventListener.setImplementation(MyEndEventExecutionListener.class.getName());
endEventListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
process.setExecutionListeners(Lists.newArrayList(endEventListener));
}
}
worked like a charm

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2013 08:21 AM
That's indeed the way we recommend doing such things to process definitions prior to deploying it for usage by the engine.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2014 04:50 PM
How is ProcessWithEndEventParseListener attached? Do you set a CustomDefault or some other means?
<java>
SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
configuration.getCustomDefaultBpmnParseHandlers().add(new ProcessWithEndEventParseListener());
</java>
<java>
SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
configuration.getCustomDefaultBpmnParseHandlers().add(new ProcessWithEndEventParseListener());
</java>

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2014 06:03 AM
getPostBpmnParseHandlers() would be the default method to use for this use case.
