summaryrefslogtreecommitdiffstats
path: root/rest-services/common-dependency
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2018-12-12 16:36:04 +0100
committerpwielebs <piotr.wielebski@nokia.com>2018-12-14 10:41:14 +0100
commit336d71e343dff06a4270bb1b724dc488498d10b2 (patch)
tree0215532a2048153ee9b02cf272d676250a442a87 /rest-services/common-dependency
parent2cf4d3c25895df964e3767ebd78ad75f1bb74619 (diff)
Add abstraction level for other components
* vesrion in poms updated to 1.1.0-SNAPSHOT Change-Id: Ieaa0a8ead1a9a74206fe4bdee85944d11b96c843 Issue-ID: DCAEGEN2-986 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'rest-services/common-dependency')
-rw-r--r--rest-services/common-dependency/pom.xml4
-rw-r--r--rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java (renamed from rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ConsumerDmaapModel.java)20
-rw-r--r--rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java24
-rw-r--r--rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java24
-rw-r--r--rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java (renamed from rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/CommonFunctions.java)22
5 files changed, 57 insertions, 37 deletions
diff --git a/rest-services/common-dependency/pom.xml b/rest-services/common-dependency/pom.xml
index f2d6b450..39cac5da 100644
--- a/rest-services/common-dependency/pom.xml
+++ b/rest-services/common-dependency/pom.xml
@@ -8,13 +8,13 @@
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-rest-services</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
<artifactId>common-dependency</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<name>dcaegen2-services-sdk-rest-services-common-dependency</name>
<description>Common functionality in the project</description>
diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ConsumerDmaapModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java
index 1bf9ff62..781aabee 100644
--- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ConsumerDmaapModel.java
+++ b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java
@@ -20,24 +20,8 @@
package org.onap.dcaegen2.services.sdk.rest.services.model;
-import com.google.gson.annotations.SerializedName;
-import org.immutables.gson.Gson;
-import org.immutables.value.Value;
+@FunctionalInterface
+public interface AaiModel extends ClientModel {
-/**
- * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 5/8/18
- */
-
-@Value.Immutable
-@Gson.TypeAdapters(fieldNamingStrategy = true)
-public interface ConsumerDmaapModel {
-
- @SerializedName(value = "correlationId", alternate = "correlationId")
String getCorrelationId();
-
- @SerializedName(value = "ipaddress-v4-oam", alternate = "ipaddress-v4-oam")
- String getIpv4();
-
- @SerializedName(value = "ipaddress-v6-oam", alternate = "ipaddress-v6-oam")
- String getIpv6();
}
diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java
new file mode 100644
index 00000000..f94985be
--- /dev/null
+++ b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java
@@ -0,0 +1,24 @@
+/*
+ * ============LICENSE_START=======================================================
+ * DCAEGEN2-SERVICES-SDK
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.services.sdk.rest.services.model;
+
+public interface ClientModel {
+}
diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java
new file mode 100644
index 00000000..6c5731d8
--- /dev/null
+++ b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java
@@ -0,0 +1,24 @@
+/*
+ * ============LICENSE_START=======================================================
+ * DCAEGEN2-SERVICES-SDK
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.services.sdk.rest.services.model;
+
+public interface DmaapModel extends ClientModel {
+}
diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/CommonFunctions.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java
index 55b12e0a..e33f914f 100644
--- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/CommonFunctions.java
+++ b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java
@@ -20,27 +20,15 @@
package org.onap.dcaegen2.services.sdk.rest.services.model;
-import com.google.gson.GsonBuilder;
-import com.google.gson.TypeAdapterFactory;
-
-import java.util.ServiceLoader;
-
-
-public class CommonFunctions {
-
- private CommonFunctions() {
- }
+@FunctionalInterface
+public interface JsonBodyBuilder<T extends ClientModel> {
/**
* Method for serialization object by GSON.
*
- * @param consumerDmaapModel - object which will be serialized
+ * @param t - object which will be serialized
* @return string from serialization
*/
- public static String createJsonBody(ConsumerDmaapModel consumerDmaapModel) {
- GsonBuilder gsonBuilder = new GsonBuilder();
- ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
- return gsonBuilder.create().toJson(ImmutableConsumerDmaapModel.builder().ipv4(consumerDmaapModel.getIpv4())
- .ipv6(consumerDmaapModel.getIpv6()).correlationId(consumerDmaapModel.getCorrelationId()).build());
- }
+
+ String createJsonBody(T t);
} \ No newline at end of file