diff options
author | grabinsk <maciej.grabinski@nokia.com> | 2019-05-23 14:25:24 +0200 |
---|---|---|
committer | grabinsk <maciej.grabinski@nokia.com> | 2019-05-23 14:25:24 +0200 |
commit | 14433b1454dd4b881b8b36f184d63528a43931ba (patch) | |
tree | 1b37d5de5dee6d701f43165ca4e35232c47a0129 /prh-commons/src/main/java | |
parent | e2f12ecdee8f9320e23b95a1671cb7c8fcacf361 (diff) |
Fix sending PNF_READY notification after update to El Alto SDK version usage
Change-Id: I06c1ae2b2a9831a4c31e09fafbe1500c10714caa
Issue-ID: DCAEGEN2-1501
Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
Diffstat (limited to 'prh-commons/src/main/java')
-rw-r--r-- | prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilder.java (renamed from prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilderImpl.java) | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilderImpl.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilder.java index 8584f01f..b39c4690 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilderImpl.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilder.java @@ -20,16 +20,13 @@ package org.onap.dcaegen2.services.prh.model; -import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapterFactory; import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel.Builder; -import org.onap.dcaegen2.services.sdk.rest.services.model.JsonBodyBuilder; +import org.onap.dcaegen2.services.prh.model.utils.PrhModelAwareGsonBuilder; -import java.util.ServiceLoader; - -public class PnfReadyJsonBodyBuilderImpl implements JsonBodyBuilder<ConsumerDmaapModel> { +public class PnfReadyJsonBodyBuilder { /** * Method for serialization object by GSON. @@ -37,9 +34,7 @@ public class PnfReadyJsonBodyBuilderImpl implements JsonBodyBuilder<ConsumerDmaa * @param consumerDmaapModel - object which will be serialized * @return string from serialization */ - public String createJsonBody(ConsumerDmaapModel consumerDmaapModel) { - GsonBuilder gsonBuilder = new GsonBuilder(); - ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory); + public JsonElement createJsonBody(ConsumerDmaapModel consumerDmaapModel) { Builder builder = ImmutableConsumerDmaapModel.builder() .correlationId(consumerDmaapModel.getCorrelationId()); @@ -47,6 +42,6 @@ public class PnfReadyJsonBodyBuilderImpl implements JsonBodyBuilder<ConsumerDmaa if(additionalFields != null && !additionalFields.equals(new JsonObject())) { builder.additionalFields(additionalFields); } - return gsonBuilder.create().toJson(builder.build()); + return PrhModelAwareGsonBuilder.createGson().toJsonTree(builder.build()); } }
\ No newline at end of file |