serviceTask field types
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2011 08:04 AM
I am looking for a possibility to implement a serviceTask which should be able to create objects with arbitrary properties. I would like to have these properties injected as Map into my serviceTask expression.
For example I want to define this in my process definition like:
My service task implementation would be like this:
As far as I know, currently only activiti:string and activiti:expression are supported. Are there any plans for supporting such a serviceTask field type.
Or should I use a different implementation strategy?
For example I want to define this in my process definition like:
<serviceTask id="javaService" name="Java service invocation" activiti:class="org.activiti.examples.bpmn.servicetask.CreateObject"> <activiti:field name="objectType" stringValue="dummy"/> <activiti:field name="properties"> <activiti:map> <activiti:entry key="key0"><activiti:string>Hello World</activiti:string></activiti:entry> <activiti:entry key="key1"><activiti:expression>Hello ${gender == 'male' ? 'Mr.' : 'Mrs.'} ${name}</activiti:expression></activiti:entry> </activiti:map> </activiti:field></serviceTask>
My service task implementation would be like this:
public class CreateObject implements JavaDelegate { … private Expression objectType; private Expression properties; public void execute(DelegateExecution execution) { String type = (String) objectType.getValue(execution); Map props = (Map)properties.getValue(execution); myRepository.addNode(type, props); }}…
As far as I know, currently only activiti:string and activiti:expression are supported. Are there any plans for supporting such a serviceTask field type.
Or should I use a different implementation strategy?
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2011 03:38 AM
No, that's not possible at this moment.
You could create the map in a script task or execution listener up front and then inject that variable with an expression.
You could create the map in a script task or execution listener up front and then inject that variable with an expression.
