Realize the delete thirdparty SDNC API. 33/13033/1
authorlizi00164331 <li.zi30@zte.com.cn>
Mon, 18 Sep 2017 07:56:58 +0000 (15:56 +0800)
committerlizi00164331 <li.zi30@zte.com.cn>
Mon, 18 Sep 2017 07:56:58 +0000 (15:56 +0800)
Change-Id: I76f64f200c1287424b8561f96942bb44fd6fc739
Issue-ID: AAI-319
Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java
esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java

index 01d8ac3..e7f5d4b 100644 (file)
@@ -69,4 +69,8 @@ public class ExternalSystemProxy {
   public static String querySdncList() throws Exception {
     return externalSystemproxy.queryThirdpartySdncList(transactionId, fromAppId, authorization);
   }
+  
+  public static void deleteThirdpartySdnc(String sdncId, String resourceVersion) throws Exception {
+    externalSystemproxy.deleteThirdpartySdnc(transactionId, fromAppId, authorization, sdncId, resourceVersion);
+  }
 }
index e5f9966..4b23fcf 100644 (file)
@@ -119,8 +119,23 @@ public class ThirdpatySdncWrapper {
   }
   
   public Response delThirdpartySdnc(String thirdpartySdncId) {
-    //TODO
-    return Response.noContent().build();
+    EsrThirdpartySdncDetail thirdpartySdncDetail = new EsrThirdpartySdncDetail();
+    thirdpartySdncDetail = queryEsrThirdpartySdncDetail(thirdpartySdncId);
+    String resourceVersion = thirdpartySdncDetail.getResourceVersion();
+    if (resourceVersion != null) {
+      try {
+        ExternalSystemProxy.deleteThirdpartySdnc(thirdpartySdncId, resourceVersion);
+        return Response.ok().build();
+      } catch (Exception e) {
+        e.printStackTrace();
+        LOG.error("Delete VNFM from A&AI failed! thirdparty SDNC ID: " + thirdpartySdncId + "resouce-version:"
+            + resourceVersion, e.getMessage());
+        return Response.serverError().build();
+      }
+    } else {
+      LOG.error("resouce-version is null ! Can not delete resouce from A&AI. ");
+      return Response.serverError().build();
+    }
   }
   
   private ThirdpartySdncRegisterInfo querySdncDetail(String sdncId) {