diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/JSON.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/JSON.java --- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/JSON.java 2018-02-19 17:32:34.000000000 +0100 +++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/JSON.java 2018-02-19 17:34:43.000000000 +0100 @@ -13,14 +13,12 @@ package com.nokia.cbam.lcm.v32; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; +import com.google.gson.*; +import com.google.gson.internal.Streams; import com.google.gson.internal.bind.util.ISO8601Utils; import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; -import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; import io.gsonfire.TypeSelector; import org.threeten.bp.LocalDate; @@ -46,6 +44,8 @@ private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private VimInfoTypeAdapter vimInfoTypeAdapter = new VimInfoTypeAdapter(); + private LcnAdapter lcnAdapter = new LcnAdapter(); public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() @@ -75,6 +75,8 @@ .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .registerTypeAdapter(VimInfo.class, vimInfoTypeAdapter) + .registerTypeAdapter(AbstractVnfNotification.class, lcnAdapter) .create(); } @@ -349,6 +351,67 @@ } } + static abstract class AbstractTypeAdapter extends TypeAdapter{ + + @Override + public void write(JsonWriter out, T value) throws IOException { + out.jsonValue(new Gson().toJson(value)); + } + + @Override + public T read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + JsonElement object = Streams.parse(in); + String type = object.getAsJsonObject().get(getTypeField()).getAsString(); + Type typeOfT = getTypeMap().get(type); + return new Gson().fromJson(object, typeOfT); + } + } + + abstract protected String getTypeField(); + abstract protected Map getTypeMap(); + + } + + public static class VimInfoTypeAdapter extends AbstractTypeAdapter { + + @Override + protected String getTypeField() { + return "vimInfoType"; + } + + @Override + protected Map getTypeMap() { + Map myMap = new HashMap(); + myMap.put(VimInfo.VimInfoTypeEnum.OPENSTACK_V2_INFO.name(), OPENSTACKV2INFO.class); + myMap.put(VimInfo.VimInfoTypeEnum.OPENSTACK_V3_INFO.name(), OPENSTACKV3INFO.class); + myMap.put(VimInfo.VimInfoTypeEnum.VMWARE_VCLOUD_INFO.name(), VMWAREVCLOUDINFO.class); + return myMap; + } + } + + public static class LcnAdapter extends AbstractTypeAdapter{ + @Override + protected String getTypeField() { + return "notificationType"; + } + + @Override + protected Map getTypeMap() { + Map myMap = new HashMap(); + myMap.put(VnfNotificationType.VNFIDENTIFIERCREATIONNOTIFICATION.name(), VnfIdentifierCreationNotification.class); + myMap.put(VnfNotificationType.VNFIDENTIFIERDELETIONNOTIFICATION.name(), VnfIdentifierDeletionNotification.class); + myMap.put(VnfNotificationType.VNFINFOATTRIBUTEVALUECHANGENOTIFICATION.name(), VnfInfoAttributeValueChangeNotification.class); + myMap.put(VnfNotificationType.VNFLIFECYCLECHANGENOTIFICATION.name(), VnfLifecycleChangeNotification.class); + myMap.put(VnfNotificationType.OTHERNOTIFICATION.name(), OtherNotification.class); + return myMap; + } + } + public JSON setDateFormat(DateFormat dateFormat) { dateTypeAdapter.setFormat(dateFormat); return this; diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OTHERVIMINFO.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OTHERVIMINFO.java --- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OTHERVIMINFO.java 2018-02-19 17:32:33.000000000 +0100 +++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OTHERVIMINFO.java 2018-02-19 17:34:43.000000000 +0100 @@ -43,13 +43,13 @@ return false; } OTHERVIMINFO OTHER_VIM_INFO = (OTHERVIMINFO) o; - return && + return super.equals(o); } @Override public int hashCode() { - return Objects.hash(, super.hashCode()); + return Objects.hash( super.hashCode()); } diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OtherNotification.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OtherNotification.java --- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OtherNotification.java 2018-02-19 17:32:33.000000000 +0100 +++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OtherNotification.java 2018-02-19 17:34:43.000000000 +0100 @@ -45,13 +45,13 @@ return false; } OtherNotification otherNotification = (OtherNotification) o; - return && + return super.equals(o); } @Override public int hashCode() { - return Objects.hash(, super.hashCode()); + return Objects.hash( super.hashCode()); } diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierCreationNotification.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierCreationNotification.java --- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierCreationNotification.java 2018-02-19 17:32:33.000000000 +0100 +++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierCreationNotification.java 2018-02-19 17:34:43.000000000 +0100 @@ -45,13 +45,13 @@ return false; } VnfIdentifierCreationNotification vnfIdentifierCreationNotification = (VnfIdentifierCreationNotification) o; - return && + return super.equals(o); } @Override public int hashCode() { - return Objects.hash(, super.hashCode()); + return Objects.hash(super.hashCode()); } diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierDeletionNotification.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierDeletionNotification.java --- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierDeletionNotification.java 2018-02-19 17:32:33.000000000 +0100 +++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierDeletionNotification.java 2018-02-19 17:34:43.000000000 +0100 @@ -45,13 +45,13 @@ return false; } VnfIdentifierDeletionNotification vnfIdentifierDeletionNotification = (VnfIdentifierDeletionNotification) o; - return && + return super.equals(o); } @Override public int hashCode() { - return Objects.hash(, super.hashCode()); + return Objects.hash( super.hashCode()); } diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfProperty.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfProperty.java --- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfProperty.java 2018-02-19 17:32:33.000000000 +0100 +++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfProperty.java 2018-02-19 17:38:08.000000000 +0100 @@ -40,6 +40,10 @@ @SerializedName("description") private String description = null; + @XmlElement(name = "value") + @SerializedName("value") + private Object value = null; + public VnfProperty name(String name) { this.name = name; return this; @@ -76,6 +80,18 @@ this.description = description; } + /** + * The value of the respective property + * @return value + **/ + @ApiModelProperty(value = "The value of the respective property ") + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } @Override public boolean equals(java.lang.Object o) { @@ -87,12 +103,13 @@ } VnfProperty vnfProperty = (VnfProperty) o; return Objects.equals(this.name, vnfProperty.name) && + Objects.equals(this.value, vnfProperty.value) && Objects.equals(this.description, vnfProperty.description); } @Override public int hashCode() { - return Objects.hash(name, description); + return Objects.hash(name, description, value); } @@ -102,6 +119,7 @@ sb.append("class VnfProperty {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append("}"); return sb.toString();