← Back to team overview

dhis2-devs team mailing list archive

Re: Sync Anonymous Event Data along with coordinates code fix

 

Hi Morten,

This is still looking for other 2 properties to map while deserializing, we
are getting exception like

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:
Unrecognized field "programInstance" (class
org.hisp.dhis.dxf2.events.event.Event), not marked as ignorable (22 known
properties: "notes", "trackedEntityInstance", "program", "lastUpdated",
"orgUnit", "href", "dataValues", "status", "orgUnitName",
"enrollmentStatus", "coordinate", "completedDate", "event", "dueDate",
"enrollment", "eventDate", "followup", "programStage", "storedBy",
"created", "attributeCategoryOptions", "completedBy"])
 at [Source:
{"program":null,"programInstance":null,"events":[{"event":"EcHeh9roBlf","status":"ACTIVE","program":"KKZTIFe5sf5","programStage":"lQgBMyAgzae","enrollment":null,"enrollmentStatus":null,"orgUnit":"fxXno3Zm20F","orgUnitName":null,"trackedEntityInstance":null,"eventDate":"2016-06-06T18:30:00.000+0000","dueDate":null,"storedBy":null,"coordinate":{"latitude":11.587669416896203,"longitude":41.66839599609375,"valid":true,"coordinateString":"[41.66839599609375,11.587669416896203]"},"dataValues":[{"created":"2016-06-14T07:21:30.781+0000","lastUpdated":"2016-06-14T07:21:30.782+0000","value":"7","dataElement":"gKGoK7Vb2yK","providedElsewhere":false,"storedBy":"Anil"}],"notes":[],"followup":null,"created":null,"lastUpdated":null,"attributeCategoryOptions":"xYerKDKCefk","completedBy":null,"completedDate":null,"href":null}],"metaData":null,"pager":null};
line: 1, column: 39] (through reference chain:
org.hisp.dhis.dxf2.events.event.Event["programInstance"])
at
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51)


Although, we see this working when we add  @JsonIgnore on getters.

@JsonIgnore
public boolean isValid()

@JsonIgnore

public String getCoordinateString()



Thanks,

Anil



On Wed, Jun 15, 2016 at 10:48 AM, Morten Olav Hansen <morten@xxxxxxxxx>
wrote:

> Already done :)
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Wed, Jun 15, 2016 at 11:50 AM, Vanya Seth <vanyas@xxxxxxxxxxxxxxxx>
> wrote:
>
>> Hi Morten
>>
>> That would be great. Please let us know when you commit the changes. We
>> ll take a merge from the trunk.
>>
>> Regards
>> Vanya
>>
>> On Wed, Jun 15, 2016 at 9:01 AM, Morten Olav Hansen <morten@xxxxxxxxx>
>> wrote:
>>
>>> Hi
>>>
>>> We usually turn off most of that Jackson auto discovery magic, I see we
>>> haven't done that properly in Jackson*<tracker object classes>, I will add
>>> that now (so it follows JacksonUtils, RenderService etc)
>>>
>>> --
>>> Morten Olav Hansen
>>> Senior Engineer, DHIS 2
>>> University of Oslo
>>> http://www.dhis2.org
>>>
>>> On Tue, Jun 14, 2016 at 8:41 PM, Anilkumar Kodi <
>>> anilkumk@xxxxxxxxxxxxxxxx> wrote:
>>>
>>>> Hi Morten,
>>>>
>>>> We are doing Anonymous Event data push. As part of that we are also
>>>> sending coordinates.
>>>>
>>>> Coordinate object has 4 public properties which are listed below
>>>>
>>>> @JsonProperty( required = true )
>>>> @JacksonXmlProperty( isAttribute = true )
>>>> public Double getLatitude()
>>>>
>>>> @JsonProperty( required = true )
>>>> @JacksonXmlProperty( isAttribute = true )
>>>> public Double getLongitude()
>>>>
>>>> public boolean isValid()
>>>>
>>>> public String getCoordinateString()
>>>>
>>>>
>>>> We don't have @JsonIgnore/@JsonProperty on the Other 2 properties.
>>>>
>>>> Because of this we are getting Error while Deserializing.
>>>>
>>>> Moreover, the JSON Mapper for the class <JacksonEventService>  has configuration FAIL_ON_UNKNOWN_PROPERTIES  set to *true*
>>>>
>>>> We have fixed this by adding @JsonIgnore on those properties.
>>>>
>>>> We Would like to know if you see any downstream issues with this minor change.
>>>>
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Anil Kumar & Srikanth
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>> With Regards
>> ThoughtWorks Technologies
>> Hyderabad
>>
>> --Stay Hungry Stay Foolish!!
>>
>
>

Follow ups

References