From: lizi00164331 Date: Mon, 18 Sep 2017 07:56:58 +0000 (+0800) Subject: Realize the delete thirdparty SDNC API. X-Git-Tag: v1.0.0~60 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fesr-server.git;a=commitdiff_plain;h=80df263c114a5b1496f0f168f01d39006c319e00 Realize the delete thirdparty SDNC API. Change-Id: I76f64f200c1287424b8561f96942bb44fd6fc739 Issue-ID: AAI-319 Signed-off-by: lizi00164331 --- 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 01d8ac3..e7f5d4b 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 @@ -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); + } } 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 e5f9966..4b23fcf 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 @@ -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) {