X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=adapters%2Fmso-adapters-rest-interface%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fmso%2Fadapters%2Fsdncrest%2FSDNCServiceResponse.java;h=c74fb089723ed5bbaedb125110d9703ce3ce13b9;hb=b6dc38501f3b746426b42d9de4cc883d894149e8;hp=2ab6ed5a8a68f6cf41162093756df6321592a621;hpb=b6b7bef8bdcad15af01ac88a038dd763ce59f68f;p=so.git diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java index 2ab6ed5a8a..c74fb08972 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * OPENECOMP - MSO + * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -19,42 +19,30 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.openecomp.mso.adapters.json.MapDeserializer; -import org.openecomp.mso.adapters.json.MapSerializer; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonDeserialize; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.jboss.resteasy.annotations.providers.NoJackson; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.LinkedHashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + // NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, // even though we are using JSON exclusively. The @NoJackson annotation // is also required in this environment. /** - * SDNC adapter success response for "agnostic" API services. Note that the - * map of response parameters is represented this way in JSON: - *
- * "params": {
- *   "entry": [
- *     {"key": "P1", "value": "V1"},
- *     {"key": "P2", "value": "V2"},
- *     ...
- *     {"key": "PN", "value": "VN"}
- *   ]
- * }
+ Map elements when marshalled to XML produce a list of ${key}${value} elements.
+ When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers.
  * 
*/ @JsonRootName("SDNCServiceResponse") -@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonInclude(Include.NON_NULL) @XmlRootElement(name = "SDNCServiceResponse") -@NoJackson public class SDNCServiceResponse extends SDNCResponseCommon implements Serializable { private static final long serialVersionUID = 1L; @@ -70,22 +58,20 @@ public class SDNCServiceResponse extends SDNCResponseCommon implements Serializa } @JsonProperty("params") - @JsonDeserialize(using = MapDeserializer.class) @XmlElement(name = "params") public Map getParams() { return params; } @JsonProperty("params") - @JsonSerialize(using = MapSerializer.class, include=JsonSerialize.Inclusion.NON_NULL) public void setParams(Map params) { this.params = params; } public void addParam(String name, String value) { if (params == null) { - params = new LinkedHashMap(); + params = new LinkedHashMap<>(); } params.put(name, value); } -} \ No newline at end of file +}