How to pass extra parameters as a part of the properties set for activiti components?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 01:59 AM
I have a requirement wherein I need to pass extra parameters,eg-serverName,serverId,etc.. along with the properties of the activiti components and parse them to get their values in the POJO classes(ExecutionListeners/TaskListeners,etc).
Please suggest how do I achieve it and also is there any API which I can leverage rather than parsing the XML directly to get hold of these extra parameters that I am passing along with the default component properties.
Please suggest how do I achieve it and also is there any API which I can leverage rather than parsing the XML directly to get hold of these extra parameters that I am passing along with the default component properties.
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 02:11 AM
Hi,
use extension elements:
http://activiti.org/userguide/index.html#bpmnCustomExtensions
e.g. (how activiti is using extensions)
extension elements are parsed into the BPMN model in memory so you can easily access them in runtime.
Regards
Martin
use extension elements:
http://activiti.org/userguide/index.html#bpmnCustomExtensions
e.g. (how activiti is using extensions)
<userTask id="theTask" name="make profit">
<extensionElements>
<activiti:customResource activiti:name="businessAdministrator">
<resourceAssignmentExpression>
<formalExpression>user(kermit), group(management)</formalExpression>
</resourceAssignmentExpression>
</activiti:customResource>
</extensionElements>
</userTask>
extension elements are parsed into the BPMN model in memory so you can easily access them in runtime.
Regards
Martin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 02:27 AM
Hi Martin,
I donot see a property titled "extensionElements" for any of the components in the Activiti modeler.
Also is there an API to access the values set using these extensions or we need to directly parse it from the BPMN2.0 xml?
I donot see a property titled "extensionElements" for any of the components in the Activiti modeler.
Also is there an API to access the values set using these extensions or we need to directly parse it from the BPMN2.0 xml?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 02:49 AM
Hi,
extension elements are stored in
Regards
Martin
Also is there an API to access the values set using these extensions or we need to directly parse it from the BPMN2.0 xml?
extension elements are stored in
org.activiti.bpmn.model.BaseElement#extensionElements
after that you can get this extension elements in e.g. org.activiti.engine.impl.bpmn.parser.handler.ServiceTaskParseHandler#executeParse
(serviceTask has extension elements in)I donot see a property titled "extensionElements" for any of the components in the Activiti modeler.I do not know whether editor supports extensionElements. But it should be possible to add them (we did it in our product).
Regards
Martin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 04:23 AM
Ok so please have a look at the code below and advise me if I'm going wrong.
public void execute(DelegateExecution execution) throws Exception {
this.delegateExecution=execution;
BpmnParser bpmnParser= new BpmnParser();
BpmnParse bpmnParse= new BpmnParse(bpmnParser);
BaseElement bE=null;
new BaseElement() {
@Override
public BaseElement clone() {
return bE.clone();
}
};
ServiceTaskParseHandler s=new ServiceTaskParseHandler();
s.parse(bpmnParse, bE);
}
This executionListener is bound to a ServiceTask in the modeler. Now are you saying that if somehow I'm able to add the extension elements to the components then this is the way to parse it??
If not please correct my understanding.
public void execute(DelegateExecution execution) throws Exception {
this.delegateExecution=execution;
BpmnParser bpmnParser= new BpmnParser();
BpmnParse bpmnParse= new BpmnParse(bpmnParser);
BaseElement bE=null;
new BaseElement() {
@Override
public BaseElement clone() {
return bE.clone();
}
};
ServiceTaskParseHandler s=new ServiceTaskParseHandler();
s.parse(bpmnParse, bE);
}
This executionListener is bound to a ServiceTask in the modeler. Now are you saying that if somehow I'm able to add the extension elements to the components then this is the way to parse it??
If not please correct my understanding.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 10:24 AM
No … this is totally not the way to go in a service task. Unless I'm missing the question here.
Get the BpmnModel for your process definition. get the particular ServiceTask, then get the extension elements.
Get the BpmnModel for your process definition. get the particular ServiceTask, then get the extension elements.
