Data Object support

Hi all,

I have a couple questions regarding the current support for data objects in the engine and in the converters:

  1. it looks like the current Activity converters (e.g. ScriptTaskXMLConverter) are not writing out their data associations to XML, is there any particular reason for that? I was able to add my own subclass which implements writeAdditionalChildElements, but it would be nice to have this supported ootb.
    The parser does read the associations in (DataInputAssociationParser#parseChildElement) so this is a bit odd…

  2. In the BpmnModel POJO hierarchy what is the right way to represent a BPMN data object reference? I was thinking of using a null itemSubjectRef (and using the “name” to match with the data object definition), is there a better way?

Thanks!
Franck

1 Like

Here is the converter implementation I am using btw, in case that’s useful:

public static void writeAssociationChildElements(Activity activity,
                                                 BpmnModel model, XMLStreamWriter xtw) throws XMLStreamException
{
	for (DataAssociation association : activity.getDataInputAssociations()) {
		XMLUtil.writeAssociation(ELEMENT_INPUT_ASSOCIATION, association, xtw);
	}
	for (DataAssociation association : activity.getDataOutputAssociations()) {
		XMLUtil.writeAssociation(ELEMENT_OUTPUT_ASSOCIATION, association, xtw);
	}
}

public static void writeAssociation(String elementName,
                                    DataAssociation association,
                                    XMLStreamWriter xtw) throws XMLStreamException
{
	xtw.writeStartElement(elementName);
	xtw.writeAttribute("id", association.getId());
	xtw.writeStartElement(BpmnXMLConstants.ELEMENT_SOURCE_REF);
	xtw.writeCharacters(association.getSourceRef());
	xtw.writeEndElement();
	xtw.writeStartElement(BpmnXMLConstants.ELEMENT_TARGET_REF);
	xtw.writeCharacters(association.getTargetRef());
	xtw.writeEndElement();
	xtw.writeEndElement();
}

Hi Franck,

The main reason is that there’s currently no logic implemented in the Engine that makes use of the data associations. So when it’s read by the XML converters and added to the BpmnModel it isn’t used in the Engine logic. For which purpose are you reading and writing the data associations? It’s definitely something that could be added to the converter logic, but just want to understand the use case.

Thanks,

Tijs

Hi Tijs,

I intend to use ParseHandlers and listeners to add the logic needed to handle those data objects… that’s the use case :slight_smile:

So for example when a ServiceTask is started I will check for any input data objects pointing to the task, and I will set up the delegate fields accordingly.

Franck

Hi Franck,

Ok understood. How do you model the process definitions to define the data input associations? Or do you build the process definition using the BpmnModel? Or do you handwrite the BPMN XML?

Best regards,

Tijs

Hi @tijs,
I am interested in this feature as well and think this topic might be related to my answer in this topic: Export BPMN to an image or pdf

We are currently modelling bpmn models in Eclipse bmpn modeler and deploy the xml to the flowable engine. As one step, we want to generate a picture for documentation reasons.

May be you know a way around the issue?

Greetings
Simon