cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a dedicated service task to activiti 6 ui kickstart editor palette

fluidnotions
Champ in-the-making
Champ in-the-making
I wrote an async service bean that can call services on our ERP via stomp/apollo broker as my first effort working with Activiti 6.0.0.Beta1.
The names of the service being called and required input I placed in execution variables via a form, referenced on the start event.

Now we'd like to make it easier for business analysts to create processes in the kickstart process editor, possibly by adding dedicated service task types to the palette. So they can drag n' drop the new activiti:type service task into the process editor and then fill in custom configuration parameters in the Properties panel of the visual editor.

That way they can add the name of the service there, required input via expressions for values that may have resulted from previous activities etc.
There may be another way to make things easy for the business analysts, I'm not sure. But using a start event referenced form, is a bit messy. Having a new dedicated service task seems the most appropriate way to allow them to configure a custom service task, in properties panel not through a form.

I have come across other people looking for ways to do this on the forum, but no answers. No info on what parts of the system to extend not in 6.0.0.Beta1 at least. Since I'm building on a beta version I'd rather not hack anything together, we want to be able to upgrade to the release when it comes out without hassles.

Can anyone give me some guidance on how I should go about doing this.
On the front end and back end.
Just some clues to get me started in the direction would be useful.

4 REPLIES 4

fluidnotions
Champ in-the-making
Champ in-the-making
I've figured out how to handle adding a new dedicated service type on the backend… in org.activiti.engine.impl.bpmn.parser.handler.ServiceTaskParseHandler.executeParse(BpmnParse, ServiceTask)
with the ServiceTask type set in org.activiti.bpmn.converter.ServiceTaskXMLConverter.convertXMLToElement(XMLStreamReader, BpmnModel) by xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TYPE)

Can anyone help me out this the front end.
In the Mail Task <extensionElements> <activiti:field name="to"> are used that can be entered as properties in the visual editor.
I want to be able to do the same thing in my new activiti:type… I found the json file where other activiti elements are defined.
Still don't have the big picture, or know the best practice around extending this.

I suppose I'll figure it out before anyone replies to this post.

fluidnotions
Champ in-the-making
Champ in-the-making
For anyone else that might wanna avoid an hour debugger session … org.activiti.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory.createMailActivityBehavior(String, List<FieldExtension>) provides a good example of how any extensionElements in xml of activiti:field end up in serviceTask.getFieldExtensions() after deployment phase, then method org.activiti.engine.impl.bpmn.parser.factory.AbstractBehaviorFactory.createFieldDeclarations(List<FieldExtension>) is used to create List<FieldDeclaration> fieldDeclarations which are then set into the ActivityBehavior class delegate using org.activiti.engine.impl.bpmn.helper.ClassDelegate.defaultInstantiateDelegate(Class<?>, List<FieldDeclaration>)

Some AngularJS insight would still be welcome though

jbarrez
Star Contributor
Star Contributor
I haven't been in that area a long time so can't remember the details, but if I'm correct you would need fiddling in the .json file that gets sent from the server. That one builds up the palette.

fluidnotions
Champ in-the-making
Champ in-the-making
For anyone who might need to get a new activiti:type to work from the activiti-app visual editor the following classes need to be considered. Existing types provide examples of what logic is required.

activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/ActivityBehaviorFactory.java
activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/DefaultActivityBehaviorFactory.java
activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/ServiceTaskParseHandler.java
activiti-image-generator/src/main/java/org/activiti/image/impl/DefaultProcessDiagramCanvas.java
activiti-image-generator/src/main/java/org/activiti/image/impl/DefaultProcessDiagramGenerator.java
activiti-json-converter/src/main/java/org/activiti/editor/constants/StencilConstants.java
activiti-json-converter/src/main/java/org/activiti/editor/language/json/converter/BaseBpmnJsonConverter.java
activiti-json-converter/src/main/java/org/activiti/editor/language/json/converter/BpmnJsonConverter.java
activiti-json-converter/src/main/java/org/activiti/editor/language/json/converter/MyNewTypeServiceTaskJsonConverter.java
activiti-process-validation/src/main/java/org/activiti/validation/validator/impl/ExternalInvocationTaskValidator.java
activiti-process-validation/src/main/java/org/activiti/validation/validator/impl/ServiceTaskValidator.java
activiti-ui/activiti-app-logic/src/main/java/com/activiti/service/editor/BpmnDisplayJsonConverter.java
activiti-ui/activiti-app-logic/src/main/resources/stencilset_bpmn.json