2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (C) 2018 IBM.
8 * Modifications Copyright (c) 2019 Samsung
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 package org.onap.so.adapters.sdnc.sdncrest;
26 import javax.servlet.http.HttpServletResponse;
27 import javax.ws.rs.Consumes;
28 import javax.ws.rs.POST;
29 import javax.ws.rs.Path;
30 import javax.ws.rs.PathParam;
31 import javax.ws.rs.Produces;
32 import javax.ws.rs.core.MediaType;
33 import javax.ws.rs.core.Response;
35 import org.onap.so.adapters.sdnc.impl.Constants;
36 import org.onap.so.logger.MessageEnum;
38 import org.onap.so.logger.MsoLogger;
39 import org.slf4j.Logger;
40 import org.slf4j.LoggerFactory;
41 import org.springframework.beans.factory.annotation.Autowired;
42 import org.springframework.core.env.Environment;
43 import org.springframework.stereotype.Component;
46 * A temporary interface to support notifications from SNIRO to BPMN.
47 * We added this to the SDNC adapter because we didn't have time to
48 * develop a SNIRO adapter in 1702.
52 public class SNIROResponse {
53 private static final Logger logger = LoggerFactory.getLogger(SNIROResponse.class);
57 private Environment env;
60 private BPRestCallback callback;
63 @Path("/SDNCNotify/SNIROResponse/{correlator}")
65 @Produces({MediaType.TEXT_PLAIN})
66 public Response serviceNotification(@PathParam("correlator") String correlator, String content) {
67 logger.info("{} {} {} {}", MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
68 "SDNCNotify/SNIROResponse");
70 String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, "");
72 if (bpUrl == null || ("").equals(bpUrl)) {
73 String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
74 logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.BPEL_REST_URL_PROP,
75 "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Missing config param");
77 return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
79 return Response.status(204).build();