Topology tree: extract AAITreeNodesEnricher out of AAIServiceTree
[vid.git] / vid-app-common / src / main / java / org / onap / vid / aai / PombaClientImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nokia. All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.vid.aai;
23
24 import com.fasterxml.jackson.databind.ObjectMapper;
25 import javax.servlet.ServletContext;
26 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
27 import org.onap.vid.model.PombaInstance.PombaRequest;
28 import org.onap.vid.utils.SystemPropertiesWrapper;
29 import org.springframework.beans.factory.annotation.Autowired;
30
31 public class PombaClientImpl implements PombaClientInterface {
32
33     protected String fromAppId = "VidAaiController";
34     EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AaiClient.class);
35
36     @Autowired
37     ServletContext servletContext;
38
39     @Autowired
40     PombaRestInterface pombaRestInterface;
41
42     @Autowired
43     SystemPropertiesWrapper systemPropertiesWrapper;
44
45     @Override
46     public void verify(PombaRequest request) {
47         String methodName = "doAaiPost";
48         logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
49         String uri = systemPropertiesWrapper.getProperty("pomba.server.url");
50
51         try {
52             pombaRestInterface.RestPost(fromAppId, uri, new ObjectMapper().writeValueAsString(request));
53         } catch (Exception e) {
54             logger.info(EELFLoggerDelegate.errorLogger, methodName, e);
55             logger.debug(EELFLoggerDelegate.debugLogger, methodName, e);
56         }
57     }
58 }