2 * Copyright 2017 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.aai.esr.wrapper;
18 import java.util.ArrayList;
20 import javax.ws.rs.core.Response;
22 import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail;
23 import org.onap.aai.esr.entity.rest.CommonRegisterResponse;
24 import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo;
25 import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy;
26 import org.onap.aai.esr.util.ThirdpartySdncManagerUtil;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
30 public class ThirdpatySdncWrapper {
32 private static ThirdpatySdncWrapper thirdpatySdncWrapper;
33 private static final Logger LOG = LoggerFactory.getLogger(ThirdpatySdncWrapper.class);
36 * get ThirdpatySdncWrapper instance.
37 * @return ThirdpatySdnc manager wrapper instance
39 public static ThirdpatySdncWrapper getInstance() {
40 if (thirdpatySdncWrapper == null) {
41 thirdpatySdncWrapper = new ThirdpatySdncWrapper();
43 return thirdpatySdncWrapper;
46 public Response registerThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) {
47 CommonRegisterResponse result = new CommonRegisterResponse();
48 EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail();
49 esrSdncDetail = ThirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc);
50 String sdncId = esrSdncDetail.getThirdpartySdncId();
52 ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail);
54 return Response.ok(result).build();
55 } catch (Exception e) {
57 LOG.error("Register thirdParty SDNC failed !" + e.getMessage());
58 return Response.serverError().build();
63 public Response updateThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) {
65 return Response.ok().build();
68 public Response queryThirdpartySdncList() {
70 ArrayList<ThirdpartySdncRegisterInfo> thirdpartySdncList = new ArrayList<ThirdpartySdncRegisterInfo>();
71 return Response.ok(thirdpartySdncList).build();
74 public Response queryThirdpartySdncById(String thirdpartySdncId) {
75 ThirdpartySdncRegisterInfo thirdpartySdnc = new ThirdpartySdncRegisterInfo();
77 return Response.ok(thirdpartySdnc).build();
80 public Response delThirdpartySdnc(String thirdpartySdncId) {
82 return Response.noContent().build();