Overriding calledMethod accounting field. Refs #9020

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-publishing/document-store-lib@150577 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-06-27 15:18:57 +00:00
parent 8bed93f60a
commit ed60687189
1 changed files with 7 additions and 6 deletions

View File

@ -60,7 +60,7 @@ public class RecordUtility {
logger.trace("addAggregatedRecordClass ({}) ", clz.getName());
addAggregatedRecordClass((Class<? extends AggregatedRecord<?,?>>) clz);
DSMapper.registerSubtypes((Class<? extends AggregatedRecord>)clz);
DSMapper.registerSubtypes((Class<? extends AggregatedRecord<?,?>>)clz);
}
}
} catch (ClassNotFoundException e) {
@ -215,21 +215,22 @@ public class RecordUtility {
/**
* Create a Record from a Map serialized using toString()
* @param serializedMap the String representation of Map
* @param serializedMapOrValidJSON the String representation of Map
* @return the Record
* @throws Exception if deserialization fails
*/
public static <R extends Record> R getRecord(String serializedMap) throws Exception {
@SuppressWarnings("unchecked")
public static <R extends Record> R getRecord(String serializedMapOrValidJSON) throws Exception {
//verify if serializedMap is a json (new serializable or old method)
if (DSMapper.isJSONValid(serializedMap)){
if (DSMapper.isJSONValid(serializedMapOrValidJSON)){
logger.debug("Unmarshal record with jackson");
return (R) DSMapper.unmarshal(Record.class, serializedMap);
return (R) DSMapper.unmarshal(Record.class, serializedMapOrValidJSON);
}
else{
//old method
logger.debug("Unmarshal record custom");
Map<String,? extends Serializable> map = getMapFromString(serializedMap);
Map<String,? extends Serializable> map = getMapFromString(serializedMapOrValidJSON);
if (map!=null){
Record record = getRecord(map);
try {