I want to create a custom user task for the Camunda Modeler, that acts like a normal user task but has a couple of additional attributes, that I want to set using the Modeler. I found the custom task example here http://docs.camunda.org/latest/real-life/how-to/#modeler-creating-custom-tasks-for-camunda-modeler but it seems to be a service task, not a user task. Is it possible to do something similar for a user task?
I'm coming from the Activiti world and wanted to use Activiti for my current project as well, but I coulnd't find a way to implement that for a user task. If that is supported by camunda BPM I would consider using camunda BPM instead. This would be very important for the project to be successful.
Thank for any help!
Best regards,
Bianca
thanks for the answer!
Is there an example describing the steps you have do take to achieve that? Do I still have to extend the AbstractCustomTaskProvider or another class? And if it's the same, where do I define whether I want to create a service task or a user task?
Thanks for your help!
Bianca
public static boolean isMyCustomTask(EObject eObject) {
return eObject instanceof UserTask && CLASS_VALUE.equals(eObject.eGet(CLASS_STRUCTURAL_FEATURE));
}
@Override
public ICreateFeature getCreateFeature(IFeatureProvider fp) {
String taskName = PluginConstants.getMyCustomTaskName();
String createDescription = "A task that talks to an endpoint";
return new AbstractCreateTaskFeature<ServiceTask>(fp, taskName, createDescription) {
@Override
protected String getStencilImageId() {
return Images.IMG_16_SERVICE_TASK;
}
@Override
public ServiceTask createBusinessObject(ICreateContext context) {
ServiceTask serviceTask = super.createBusinessObject(context);
serviceTask.eSet(PluginConstants.CLASS_STRUCTURAL_FEATURE, PluginConstants.CLASS_VALUE);
return serviceTask;
}
@Override
public EClass getBusinessObjectClass() {
return Bpmn2Package.eINSTANCE.getServiceTask();
}
};
}
thanks for your help!
I installed camunda BPM to my machine and looked into the tutorial. I used the example code from github to have a working configuration before I started to customize it and change everything to UserTask.
I can run the plugin and a custom user task is shown, but when I add to the process I don't have a cutom tab added to the properties. Looking into the tutorial again I figured, that the modeler might identify the custom (service) task by the class that was assigned to it. But because I have a user task there is no class to assign. Is there another way I can add custom properties with or without custom tabs?
I have to say that I'm really glad, that this forum is so active and everyone is so supportive here!
Cheers
Bianca
Ok, I just found the solution myself. It was much easier than expected. In case anyone else might have the same problem:
In the example files is a class PluginConstants that contains a method isMyCustomTask(EObject eObject). I changed the return value to "eObject instanceof UserTask" because for me it works to change all user tasks to custom tasks. Otherwise there would have to be some kind an identifier.
But I still have some questions left. Maybe someone can help. The tutorial describes how to add a custom tab. Is there a way to add custom fields to the existing tabs as well?
And is there a way to remove task types etc. from the modeler view (e.g. remove the standard user task as it is not needed anymore).
Thanks for the help!
Bianca