summaryrefslogtreecommitdiffstats
path: root/esr-mgr/src
diff options
context:
space:
mode:
authorlizi00164331 <li.zi30@zte.com.cn>2017-09-18 15:16:51 +0800
committerlizi00164331 <li.zi30@zte.com.cn>2017-09-18 15:16:51 +0800
commit8f5e361483e985a25c2d48cea5ada4e6de9e60d0 (patch)
treebd67772faadbf1e0e7b3bf48d7501d562cf75bc4 /esr-mgr/src
parentcab18110a636691b277ab94a5d6e202c275a8dfc (diff)
Realize query thirdparty sdnc list API.
Change-Id: I241134d56f0aa495546c8987d038c986ed6b7468 Issue-ID: AAI-317 Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr/src')
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java68
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java37
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java4
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java30
4 files changed, 136 insertions, 3 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java
new file mode 100644
index 0000000..89e1ffd
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * 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.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+public class EsrThirdpartySdnc implements Serializable {
+public static final long serialVersionUID = 1L;
+
+ @SerializedName("thirdparty-sdnc-id")
+ private String thirdpartySdncId;
+
+ @SerializedName("location")
+ private String location;
+
+ @SerializedName("product-name")
+ private String productName;
+
+ @SerializedName("resource-version")
+ private String resourceVersion;
+
+ public String getThirdpartySdncId() {
+ return thirdpartySdncId;
+ }
+
+ public void setThirdpartySdncId(String thirdpartySdncId) {
+ this.thirdpartySdncId = thirdpartySdncId;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java
new file mode 100644
index 0000000..8340e31
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * 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.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import com.google.gson.annotations.SerializedName;
+
+public class EsrThirdpartySdncList implements Serializable {
+
+ public static final long serialVersionUID = 1L;
+
+ @SerializedName("esr-thirdparty-sdnc")
+ private ArrayList<EsrThirdpartySdnc> esrThirdpartySdnc;
+
+ public ArrayList<EsrThirdpartySdnc> getEsrThirdpartySdnc() {
+ return esrThirdpartySdnc;
+ }
+
+ public void setEsrThirdpartySdnc(ArrayList<EsrThirdpartySdnc> esrThirdpartySdnc) {
+ this.esrThirdpartySdnc = esrThirdpartySdnc;
+ }
+}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java
index eda2eb2..01d8ac3 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java
@@ -65,4 +65,8 @@ public class ExternalSystemProxy {
public static String queryThirdpartySdncDetail(String thirdpartySdncId) throws Exception{
return externalSystemproxy.queryThirdpartySdncDetail(transactionId, fromAppId, authorization, thirdpartySdncId);
}
+
+ public static String querySdncList() throws Exception {
+ return externalSystemproxy.queryThirdpartySdncList(transactionId, fromAppId, authorization);
+ }
}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java
index f9246f7..20b8eab 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import javax.ws.rs.core.Response;
import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail;
+import org.onap.aai.esr.entity.aai.EsrThirdpartySdncList;
import org.onap.aai.esr.entity.rest.CommonRegisterResponse;
import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo;
import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy;
@@ -68,9 +69,19 @@ public class ThirdpatySdncWrapper {
}
public Response queryThirdpartySdncList() {
- //TODO
- ArrayList<ThirdpartySdncRegisterInfo> thirdpartySdncList = new ArrayList<ThirdpartySdncRegisterInfo>();
- return Response.ok(thirdpartySdncList).build();
+ ArrayList<ThirdpartySdncRegisterInfo> sdncList = new ArrayList<ThirdpartySdncRegisterInfo>();
+ EsrThirdpartySdncList esrSdnc = new EsrThirdpartySdncList();
+ try {
+ String esrSdncStr = ExternalSystemProxy.querySdncList();
+ esrSdnc = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncList.class);
+ LOG.info("Response from AAI by query thirdparty SDNC list: " + esrSdnc);
+ sdncList = getSdncDetailList(esrSdnc);
+ return Response.ok(sdncList).build();
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOG.error("Query thirdparty SDNC list failed !");
+ return Response.serverError().build();
+ }
}
public Response queryThirdpartySdncById(String thirdpartySdncId) {
@@ -103,4 +114,17 @@ public class ThirdpatySdncWrapper {
return null;
}
}
+
+ private ArrayList<ThirdpartySdncRegisterInfo> getSdncDetailList(EsrThirdpartySdncList esrThirdPartySdnc) {
+ ArrayList<ThirdpartySdncRegisterInfo> sdncInfoList = new ArrayList<ThirdpartySdncRegisterInfo>();
+ ThirdpartySdncRegisterInfo sdncInfo = new ThirdpartySdncRegisterInfo();
+ for (int i = 0; i < esrThirdPartySdnc.getEsrThirdpartySdnc().size(); i++) {
+ String sdncId = esrThirdPartySdnc.getEsrThirdpartySdnc().get(i).getThirdpartySdncId();
+ sdncInfo = querySdncDetail(sdncId);
+ if (sdncInfo != null) {
+ sdncInfoList.add(sdncInfo);
+ }
+ }
+ return sdncInfoList;
+ }
}