AnsweredAssumed Answered

How to map node's properties from JSON format to Map<QName, Serializable> Java object?

Question asked by mbel on Dec 7, 2016
Latest reply on Dec 13, 2016 by afaust

Hello,
I have a JSON representation of the properties of a node:

 

"properties": {
"{http://www.alfresco.org/model/content/1.0}email": "admin@alfresco.com",
"{http://www.alfresco.org/model/content/1.0}homeFolder": {
"storeRef": {
"protocol": "workspace",
"identifier": "SpacesStore"
},
"id": "b2e97ee9-1154-411e-b9b7-a7d105049b0a"
},
"{http://www.alfresco.org/model/system/1.0}cascadeTx": 163,
"{http://www.alfresco.org/model/content/1.0}lastName": "",
"{http://www.alfresco.org/model/content/1.0}preferenceValues": {
"id": 290,
"contentUrl": "store://2016/11/28/22/56/92a777ff-5dbe-461b-8d09-565d94182254.bin",
"mimetype": "text/plain",
"size": 275,
"encoding": "UTF-8",
"locale": "en_US"
},
"{http://www.alfresco.org/model/content/1.0}organizationId": "",
"{http://www.alfresco.org/model/system/1.0}node-uuid": "e8d408b8-1e7b-41c2-8722-0f7327df6919",
"{http://www.alfresco.org/model/content/1.0}name": "e8d408b8-1e7b-41c2-8722-0f7327df6919",
"{http://www.alfresco.org/model/content/1.0}sizeCurrent": 0,
"{http://www.alfresco.org/model/system/1.0}store-protocol": "workspace",
"{http://www.alfresco.org/model/system/1.0}store-identifier": "SpacesStore",
"{http://www.alfresco.org/model/system/1.0}node-dbid": 32,
"{http://www.alfresco.org/model/system/1.0}locale": "en_US",
"{http://www.alfresco.org/model/content/1.0}userName": "admin",
"{http://www.alfresco.org/model/content/1.0}homeFolderProvider": "bootstrapHomeFolderProvider",
"{http://www.alfresco.org/model/content/1.0}owner": "admin",
"{http://www.alfresco.org/model/system/1.0}cascadeCRC": 133767139,
"{http://www.alfresco.org/model/content/1.0}firstName": "Administrator"
}

 

 

And I have an issue while mapping it to Map<QName, Serializable> Java object.
I can easily parse the String to QName, but I have a problem with the Serializable interface:

 

11070010 Can not construct instance of java.io.Serializable, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@6a5c3c62; line: 1, column: 22376] 

 

Is there any way of getting the type against an QName in order to parse it automatically to that type?
Example -> "{http://www.alfresco.org/model/system/1.0}locale":  -> Locale.class
Or if someone has some other suggestions, I will be happy if you can share them.

 

Thank you in advance.

Outcomes