X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=esr-mgr%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fesr%2Fwrapper%2FThirdpatySdncWrapper.java;h=9bc61adc0fc50121b04463797764552ea01101e2;hb=a4771e502b3385e1cfc314e79deba7aca0c828c0;hp=bfbae7b4bf7896191b46c85f4911a7fbbeb052dd;hpb=91e4d4835374d407f8a31b61f2cd601a259b13b1;p=aai%2Fesr-server.git 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 bfbae7b..9bc61ad 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 @@ -19,15 +19,18 @@ import java.util.ArrayList; import javax.ws.rs.core.Response; -import org.onap.aai.esr.entity.rest.RegisterResponse; -import org.onap.aai.esr.entity.rest.ThirdPartySdncRestData; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; +import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; +import org.onap.aai.esr.entity.rest.CommonRegisterResponse; +import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo; +import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy; +import org.onap.aai.esr.util.ThirdpartySdncManagerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ThirdpatySdncWrapper { private static ThirdpatySdncWrapper thirdpatySdncWrapper; -// private static final Logger LOG = LoggerFactory.getLogger(ThirdpatySdncWrapper.class); + private static final Logger LOG = LoggerFactory.getLogger(ThirdpatySdncWrapper.class); /** * get ThirdpatySdncWrapper instance. @@ -40,25 +43,36 @@ public class ThirdpatySdncWrapper { return thirdpatySdncWrapper; } - public Response registerThirdpartySdnc(ThirdPartySdncRestData thirdpartySdnc) { - //TODO - RegisterResponse result = null; - return Response.ok(result).build(); + public Response registerThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); + esrSdncDetail = ThirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); + String sdncId = esrSdncDetail.getThirdpartySdncId(); + try { + ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); + result.setId(sdncId); + return Response.ok(result).build(); + } catch (Exception e) { + e.printStackTrace(); + LOG.error("Register thirdParty SDNC failed !" + e.getMessage()); + return Response.serverError().build(); + } + } - public Response updateThirdpartySdnc(ThirdPartySdncRestData thirdpartySdnc) { + public Response updateThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) { //TODO return Response.ok().build(); } public Response queryThirdpartySdncList() { //TODO - ArrayList thirdpartySdncList = new ArrayList(); + ArrayList thirdpartySdncList = new ArrayList(); return Response.ok(thirdpartySdncList).build(); } public Response queryThirdpartySdncById(String thirdpartySdncId) { - ThirdPartySdncRestData thirdpartySdnc = new ThirdPartySdncRestData(); + ThirdpartySdncRegisterInfo thirdpartySdnc = new ThirdpartySdncRegisterInfo(); //TODO return Response.ok(thirdpartySdnc).build(); }