I have poked into the source code of Activiti and trouble is related to what happens in BpmnXMLConverter class. For the new class I've created, CreatePurchaseOrderServiceTask (which extends ServiceTask!), the lookup to find a converter will fail since it uses the flowElement.getClass() to do a lookup in a map of prepopulated converteres:
Class<? extends BaseBpmnXMLConverter> converter = convertersToXMLMap.get(flowElement.getClass());
When using the ordinary ServiceTask the lookup will find this one:
addConverter(ServiceTaskXMLConverter.getXMLType(), ServiceTaskXMLConverter.getBpmnElementType(), ServiceTaskXMLConverter.class);
while when I use my own class it won't find anything, and hence fail on this test:
if (converter == null) {
throw new XMLException("No converter for " + flowElement.getClass() + " found");
}
Is this a bug or a feature? Doesn't seem like Activiti supports subclasses of ServiceTask to be used since the converters in the map is only populated through static initializer.
Any input from the Activiti developers?