From 6b5dd86a3557e8eed2c4584f5d16df5654cbc57b Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Wed, 8 Jan 2020 16:03:08 +0200 Subject: Fix the format of supplementary file and user params for aLaCarte requests supplementary file shall be in format [{"name": "fieldName", "value" : "xyz"}] Also this is the format of each param in user params for aLaCarte requests and old macros Issue-ID: VID-743 Change-Id: I579298ce3f0b789a7a69e6af5a85bfbd50ae9fc0 Signed-off-by: Eylon Malin --- .../model/ServiceInstantiationRequestDetails.java | 35 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java') diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java index e610d6c40..acbf778ea 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java @@ -20,15 +20,16 @@ package org.onap.vid.mso.model; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import org.onap.vid.mso.rest.SubscriberInfo; - import java.util.List; import java.util.Map; - -import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; -import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; +import java.util.Objects; +import org.onap.vid.mso.rest.SubscriberInfo; public class ServiceInstantiationRequestDetails { @@ -122,7 +123,11 @@ public class ServiceInstantiationRequestDetails { private final String name; private final String value; - public UserParamNameAndValue(String name, String value) { + @JsonCreator + public UserParamNameAndValue( + @JsonProperty("name") String name, + @JsonProperty("value") String value + ) { this.name = name; this.value = value; } @@ -134,6 +139,24 @@ public class ServiceInstantiationRequestDetails { public String getValue() { return value; } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UserParamNameAndValue)) { + return false; + } + UserParamNameAndValue that = (UserParamNameAndValue) o; + return Objects.equals(getName(), that.getName()) && + Objects.equals(getValue(), that.getValue()); + } + + @Override + public int hashCode() { + return Objects.hash(getName(), getValue()); + } } public static class HomingSolution implements UserParamTypes { -- cgit 1.2.3-korg