From 54150062fd38ba20bec6b68e4066538051c381f2 Mon Sep 17 00:00:00 2001 From: CRUZ Date: Wed, 21 Mar 2018 19:49:32 -0500 Subject: Fix Serialized Names for Legacy APPC The legacy APPC request and response messages must be upper camel case. Issue-ID: POLICY-681 Change-Id: I439fa22b76dd2cb35a054bf93260705b8cf1af51 Signed-off-by: dc443y --- .../src/main/java/org/onap/policy/appc/CommonHeader.java | 15 +++++++++++++++ .../appc/src/main/java/org/onap/policy/appc/Request.java | 11 +++++++++++ .../appc/src/main/java/org/onap/policy/appc/Response.java | 7 +++++++ .../src/main/java/org/onap/policy/appc/ResponseCode.java | 3 +++ .../main/java/org/onap/policy/appc/ResponseStatus.java | 7 +++++++ .../src/main/java/org/onap/policy/appc/ResponseValue.java | 3 +++ 6 files changed, 46 insertions(+) (limited to 'controlloop/common/model-impl/appc') diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java index 8ae029b76..506303fc2 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java @@ -27,15 +27,30 @@ import java.util.Collection; import java.util.Map; import java.util.UUID; +import com.google.gson.annotations.SerializedName; + public class CommonHeader implements Serializable { private static final long serialVersionUID = -3581658269910980336L; + @SerializedName("TimeStamp") private Instant timeStamp = Instant.now(); + + @SerializedName("APIver") private String apiVer = "1.01"; + + @SerializedName("OriginatorID") private String originatorID; + + @SerializedName("RequestID") private UUID requestID; + + @SerializedName("SubRequestID") private String subRequestID; + + @SerializedName("RequestTrack") private Collection requestTrack = new ArrayList<>(); + + @SerializedName("Flags") private Collection> flags = new ArrayList<>(); public CommonHeader() { diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java index a74626000..fd37d31b2 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java @@ -24,13 +24,24 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import com.google.gson.annotations.SerializedName; + public class Request implements Serializable{ private static final long serialVersionUID = -3912323643990646431L; + @SerializedName("CommonHeader") private CommonHeader commonHeader; + + @SerializedName("Action") private String action; + + @SerializedName("TargetID") private String targetID; + + @SerializedName("ObjectID") private String objectID; + + @SerializedName("Payload") private HashMap payload = new HashMap<>(); public Request() { diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java index e00205998..b117350ae 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java @@ -24,11 +24,18 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import com.google.gson.annotations.SerializedName; + public class Response implements Serializable { private static final long serialVersionUID = 434953706339865151L; + @SerializedName("CommonHeader") private CommonHeader commonHeader; + + @SerializedName("Status") private ResponseStatus status = new ResponseStatus(); + + @SerializedName("Payload") private HashMap payload = new HashMap<>(); public Response() { diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java index fa96067c4..3b0d445aa 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java @@ -20,6 +20,8 @@ package org.onap.policy.appc; +import com.google.gson.annotations.SerializedName; + public enum ResponseCode { ACCEPT(100), ERROR(200), @@ -28,6 +30,7 @@ public enum ResponseCode { FAILURE(500) ; + @SerializedName("Code") private Integer code; private ResponseCode(int code) { diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java index 7cef50127..7f85ac7a7 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java @@ -22,11 +22,18 @@ package org.onap.policy.appc; import java.io.Serializable; +import com.google.gson.annotations.SerializedName; + public class ResponseStatus implements Serializable { private static final long serialVersionUID = 2421770469587860452L; + @SerializedName("Code") private int code; + + @SerializedName("Value") private String value; + + @SerializedName("Description") private String description; @Override diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java index e750b60a6..8d9bede23 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java @@ -20,6 +20,8 @@ package org.onap.policy.appc; +import com.google.gson.annotations.SerializedName; + public enum ResponseValue { ACCEPT("ACCEPT"), ERROR("ERROR"), @@ -28,6 +30,7 @@ public enum ResponseValue { FAILURE("FAILURE") ; + @SerializedName("Value") private String value; private ResponseValue(String value) { -- cgit 1.2.3-korg