cancel
Showing results for 
Search instead for 
Did you mean: 

Deserialisation of complex object fails in activiti

mrhu
Champ in-the-making
Champ in-the-making
Hallo,

Given the following serialisation of a mesurement object:

{
  "deviceID":"AA:FF.04Smiley Very Happy3Smiley Very HappyD:90",
  "deviceName":"A&D_UC321PBT-C",
  "deviceType":"MDC_DEV_SPEC_PROFILE_SCALE",
  "measurementEntities" [{
                         "measurementType":"MDC_MASS_BODY_ACTUAL",
                         "measurementUnit":"MDC_DIM_KILO_G",
                         "measurementValue":"86.5",
                         "measurementDateTime":"2012-04-13 15:53:38"}],
}

Activiti Explorer creates the following process variables:

  deviceID = AA:FF.04Smiley Very Happy3Smiley Very HappyD:90,
  deviceName = A&D_UC321PBT-C,
  deviceType = MDC_DEV_SPEC_PROFILE_SCALE,
  measurementEntities = null
 
But I would have expected the following:

  deviceID = AA:FF.04Smiley Very Happy3Smiley Very HappyD:90,
  deviceName = A&D_UC321PBT-C,
  deviceType = MDC_DEV_SPEC_PROFILE_SCALE,
  measurementEntities = [client.model.MeasurementEntities@788896d5]

When using the serviceTask and creating the this object via a factory encapsulated in the serviceTask, I will get the expected object. The serviceTask is defined as follows and object model is deplolyed to activiti either to explorer and rest.

   <serviceTask id="sid-8BA4EC63-5264-46A0-AFB9-661AA8882AF0" activiti:class="server.controller.CreateMeasurementDelegate" name="Create Measurement"/>

Why does the activit-rest doesn't deserialise the object correctly when sending the above shown json to activiti-rest/service/task/4711/complete?

Thanks,
Marco
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
The rest api doesn't do auto json conversion to objects. Or do you mean it's done by a service task of yourself? In that case, the json is just a string passed to the API and it should just work, no?

mrhu
Champ in-the-making
Champ in-the-making
The service task is just for illustration that I can have a complex object as a process variable. What I want to know is, can the rest-api create this complex object based on the json as for example the service task does by means of a factory. What I found out so far is that activiti is able to handle simple objects.


As a footnote: In previous sofware projects I implemented a rest apis that were able to create such complex objects by using an unmashaller(jackson or jersey) passing it the json and the class model. Same behavior, I would expect from activiti when my class model is deployed to activiti.

I hope this helps to clarify my request.

Thanks, Marco

jbarrez
Star Contributor
Star Contributor
Yes, I do understand it now. However, the rest api currently only accepts primitive types.