diff options
Diffstat (limited to 'prh-commons/src/main')
-rw-r--r-- | prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java | 4 | ||||
-rw-r--r-- | prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/JsonBodyBuilderImpl.java (renamed from prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java) | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java index 6d488c85..b2bac24c 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java @@ -23,6 +23,8 @@ package org.onap.dcaegen2.services.prh.model; import com.google.gson.annotations.SerializedName; import org.immutables.gson.Gson; import org.immutables.value.Value; +import org.onap.dcaegen2.services.sdk.rest.services.model.AaiModel; +import org.onap.dcaegen2.services.sdk.rest.services.model.DmaapModel; /** * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 5/8/18 @@ -30,7 +32,7 @@ import org.immutables.value.Value; @Value.Immutable @Gson.TypeAdapters(fieldNamingStrategy = true) -public interface ConsumerDmaapModel { +public interface ConsumerDmaapModel extends AaiModel, DmaapModel { @SerializedName(value = "correlationId", alternate = "correlationId") String getCorrelationId(); diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/JsonBodyBuilderImpl.java index 20820fce..b504a4bd 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/JsonBodyBuilderImpl.java @@ -22,13 +22,14 @@ package org.onap.dcaegen2.services.prh.model; import com.google.gson.GsonBuilder; import com.google.gson.TypeAdapterFactory; +import org.onap.dcaegen2.services.sdk.rest.services.model.JsonBodyBuilder; + import java.util.ServiceLoader; -public class CommonFunctions { +public class JsonBodyBuilderImpl implements JsonBodyBuilder<ConsumerDmaapModel> { - private CommonFunctions() { - } + public JsonBodyBuilderImpl() {} /** * Method for serialization object by GSON. @@ -36,7 +37,7 @@ public class CommonFunctions { * @param consumerDmaapModel - object which will be serialized * @return string from serialization */ - public static String createJsonBody(ConsumerDmaapModel consumerDmaapModel) { + public String createJsonBody(ConsumerDmaapModel consumerDmaapModel) { GsonBuilder gsonBuilder = new GsonBuilder(); ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory); return gsonBuilder.create().toJson(ImmutableConsumerDmaapModel.builder().ipv4(consumerDmaapModel.getIpv4()) |