DataObject vs custom types

Hi all,

I try to create process instance initialized with a process variable that is a custom type (a Java bean containing collections to transmit to a service task for example ). The variable is declared into the BPMN as a DataObject to reference my custom type. It seems that it is not possible to create such a process instance ?

Can you confirm that only primitive types (string, date, boolean, double, int, long) are supported for DataObject, as mentioned in Flowable documentation §8.9 and in source code ?

If needed can you drive me to write a contribution to add a new supported type for DataObject. As the type defined for the DataObject is based on XSD, perhaps wan we use JaxB on the fly to support custom types ?

Thanks for your help,

Looking at that code, it seems indeed that only primitives are supported currently.

Adding jaxb as a core engine dependency is not something that we’d want to do (it brings in all kind of issue on various platforms). Is there another way of supporting it without jaxb?
Instead of having a java bean, wouldn’t a JSON variable make more sense here and be more flexible?

Hi @joram,

Using JaxB was a proposal. In fact, a simple JavaBean object should be sufficient. The JaxB unmarshalling (XML --> JavaBean) part will be into my application embedding the Flowable engine.

What do you mean by JSON variable mainly in a Java point of view for implemention ?

Can you tell me how is stored a dataobject into the Flowable database, perhaps this has impacts on java beans that can be used ?

Hi @cdeneux, I saw i never responded to your follow-up question, apologies.

I was referring to the fact you were using beans to work with collections. As such, putting these collections in a json variable would maybe be a more suitable way (but of course, not sure about your use case).

Date objects are “metadata only”, meaning they are defined on the model level, and used to create variable at runtime . They are effectively a wrapper for variables, you can for example see that here:

Sorry @joram, I do not have time to work on this topic right now.

I will try to come back to it in 2nd part of September.

No problem :slight_smile: Let us know something on the forum here in case you’d need some guidance or pointers.

Hi @joram, hi all,

I’m working to a contribution to the webservice task to support structured variables. With this, we can easily assigned object list from Flowable variables to SOAP request elements.

As you mentionned below, I used the type “json” for structured variables. Json variables are converted into XML for the outgoing SOAP Request. This way works fine now.

In the other way, incoming SOAP reply, I wish to be able to map an object list of the SOAP reply to a Flowable variable. I thought to convert the XML part in JSON. But it seems it’s not so easily because the Flowable variable that holds JSON value must be declared as a DataObject, and Json is not a type supported by DataObject. Moreover, which value to set in itemSubjectRef to define the type ‘json’ for a DataObject. Perhaps can we use the JavaBean types generated on-the-fly by flowable-cxf according to the service WSDL.

Can you give me your opinion to drive me on the best way ?

Thanks a lot,

Nice :slight_smile:

Indeed, the data object structure of BPMN is meant for XML mostly. There’s probably two paths:

  • ignore the data object and directly store the variable, without reading the data object definition

  • enhance the data object and make it so it can also be serialized as json. This wouldn’t be spec-compliant, but it’s probably the best way forward?

Not sure I’m following this yet. Can you elaborate?

Hi @joram,

After several tries, it seems to me to have resulted in a simple solution.

I introduced a hack at data object type definition: the type xsd:json will force the Json type for data objects. And at the level of the data output association transformation, if the value returned by the service is a Java bean, we try to position the variable as json.

Is it acceptable for you ?

If existing, can you give me some inputs to add unit tests about the processing of data output association transformations ? I’m not be able to find such existing unit tests in module flowable-engine.

I will push a PR for code review.

Thanks for your help,

The PR: