Activiti Modeler - custom components

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2013 12:11 PM
Is it possible to have combobox with predifined variables in the Service Task component instead of Complex type (list of values) for Class field (Field extension) in the Activiti Modeler 5.11.
What I want to do is to create custom component with predefined java class that implements the service task logic and only one variable (class field) which has several predefined values and represent it as a combo box. The same logic as we have with Activiti designer extension (AbstractCustomServiceTask) in Eclipse:
Currently, json for service task fields looks like this:
and I want to replace:
with:
and to add predefined values for the related variable.
What I want to do is to create custom component with predefined java class that implements the service task logic and only one variable (class field) which has several predefined values and represent it as a combo box. The same logic as we have with Activiti designer extension (AbstractCustomServiceTask) in Eclipse:
@Property(type = PropertyType.COMBOBOX_CHOICE, displayName = "Account type", required = true)@Help(displayHelpShort = "The type of account", displayHelpLong = "Choose a type of account from the list of options")@PropertyItems({ ACCOUNT_TYPE_SAVINGS_LABEL, ACCOUNT_TYPE_SAVINGS_VALUE, ACCOUNT_TYPE_JUNIOR_LABEL, ACCOUNT_TYPE_JUNIOR_VALUE, ACCOUNT_TYPE_JOINT_LABEL, ACCOUNT_TYPE_JOINT_VALUE, ACCOUNT_TYPE_TRANSACTIONAL_LABEL, ACCOUNT_TYPE_TRANSACTIONAL_VALUE, ACCOUNT_TYPE_STUDENT_LABEL, ACCOUNT_TYPE_STUDENT_VALUE, ACCOUNT_TYPE_SENIOR_LABEL, ACCOUNT_TYPE_SENIOR_VALUE })private String accountType;
Currently, json for service task fields looks like this:
{ "id" : "servicetaskfields", "type" : "Complex", "title" : "Class fields", "value" : "", "description" : "Field extensions", "popular" : true, "complexItems" : [ { "id" : "servicetask_field_name", "name" : "Name", "type" : "String", "value" : "", "width" : 200, "optional" : false }, { "id" : "servicetask_field_value", "name" : "String value", "type" : "String", "value" : "", "width" : 200, "optional" : false }, { "id" : "servicetask_field_expression", "name" : "Expression", "type" : "String", "value" : "", "width" : 200, "optional" : false } ] }
and I want to replace:
"type" : "Complex"
with:
"type" : "Choice"
and to add predefined values for the related variable.
Labels:
- Labels:
-
Archive
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2013 01:18 PM
Sure, that's perfectly possible.
Best regards,
Best regards,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2013 02:04 PM
Sure, that's perfectly possible.
Do you have any example, demo that can be helpful, because I already try it on my way but without success?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2013 02:12 PM
No there's no example yet. The best way is to look at the other attribute definitions at the moment.
Best regards,
Best regards,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2013 05:58 AM
The problem is when I replace above json "Complex type" code with "Choice":
I get regular combo box with values in the properties panel and after I select value and generate bpmn20.xml I get:
Instead of:
which I get with Complex type. Am I missing something?
{
"id" : "servicetaskfields",
"type" : "Choice",
"title" : "Class fields",
"value" : "action",
"description" : "Field extensions",
"popular" : true,
"items" : [ {
"id" : "v1",
"title" : "Value1",
"value" : "0"
}, {
"id" : "v2",
"title" : "Value2",
"value" : "1",
} ]
}
I get regular combo box with values in the properties panel and after I select value and generate bpmn20.xml I get:
<serviceTask id="sid-682459E4-9AE5-49A1-8EBB-CE0584676771" name="TestService" activiti:class="de.pickert.bpmn.services.ActionService"></serviceTask>
Instead of:
<serviceTask id="sid-682459E4-9AE5-49A1-8EBB-CE0584676771" name="TestService" activiti:class="de.pickert.bpmn.services.ActionService">
<extensionElements>
<activiti:field name="action" stringValue="0"></activiti:field>
</extensionElements>
</serviceTask>
which I get with Complex type. Am I missing something?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2013 11:08 AM
That's because the transformation from the field extensions attribute expects a complex type and not a choice.
For this to work you would have to implement the right transformation logic in the activiti-json-converter project.
Best regards,
For this to work you would have to implement the right transformation logic in the activiti-json-converter project.
Best regards,
