2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.bpmn.common.workflow.service;
25 import javax.jws.Oneway;
26 import javax.jws.WebMethod;
27 import javax.jws.WebParam;
28 import javax.jws.WebService;
29 import javax.ws.rs.core.Context;
30 import javax.xml.ws.Action;
31 import javax.xml.ws.RequestWrapper;
32 import javax.xml.ws.WebServiceContext;
34 import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
35 import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
36 import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
37 import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification;
38 import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification;
39 import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
40 import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify;
41 import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
42 import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
43 import org.onap.so.logger.MsoLogger;
44 import org.springframework.beans.factory.annotation.Autowired;
45 import org.springframework.stereotype.Service;
48 * Implementation of the VnfAdapterNotify service.
50 @WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
52 public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{
54 private final String logMarker = "[VNF-NOTIFY]";
57 CallbackHandlerService callback;
59 @Context WebServiceContext wsContext;
61 @WebMethod(operationName = "rollbackVnfNotification")
63 @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
64 @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest")
65 public void rollbackVnfNotification(
66 @WebParam(name = "messageId", targetNamespace = "")
68 @WebParam(name = "completed", targetNamespace = "")
70 @WebParam(name = "exception", targetNamespace = "")
71 MsoExceptionCategory exception,
72 @WebParam(name = "errorMessage", targetNamespace = "")
73 String errorMessage) {
75 RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
77 rollbackVnfNotification.setMessageId(messageId);
78 rollbackVnfNotification.setCompleted(completed);
79 rollbackVnfNotification.setException(exception);
80 rollbackVnfNotification.setErrorMessage(errorMessage);
82 String method = "rollbackVnfNotification";
83 Object message = rollbackVnfNotification;
84 String messageEventName = "rollbackVnfNotificationCallback";
85 String messageVariable = "rollbackVnfNotificationCallback";
86 String correlationVariable = "VNFRB_messageId";
87 String correlationValue = messageId;
89 callback.handleCallback(method, message, messageEventName, messageVariable,
90 correlationVariable, correlationValue, logMarker);
93 @WebMethod(operationName = "queryVnfNotification")
95 @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
96 @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest")
97 public void queryVnfNotification(
98 @WebParam(name = "messageId", targetNamespace = "")
100 @WebParam(name = "completed", targetNamespace = "")
102 @WebParam(name = "exception", targetNamespace = "")
103 MsoExceptionCategory exception,
104 @WebParam(name = "errorMessage", targetNamespace = "")
106 @WebParam(name = "vnfExists", targetNamespace = "")
108 @WebParam(name = "vnfId", targetNamespace = "")
110 @WebParam(name = "status", targetNamespace = "")
112 @WebParam(name = "outputs", targetNamespace = "")
113 QueryVnfNotification.Outputs outputs){
115 String method = "queryVnfNotification";
116 String messageEventName = "queryVnfNotificationCallback";
117 String messageVariable = "queryVnfNotificationCallback";
118 String correlationVariable = "VNFQ_messageId";
119 String correlationValue = messageId;
121 MsoLogger.setLogContext(correlationValue, "N/A");
123 QueryVnfNotification message = new QueryVnfNotification();
125 message.setMessageId(messageId);
126 message.setCompleted(completed);
127 message.setException(exception);
128 message.setErrorMessage(errorMessage);
129 message.setVnfExists(vnfExists);
130 message.setVnfId(vnfId);
131 message.setStatus(status);
132 message.setOutputs(outputs);
134 callback.handleCallback(method, message, messageEventName, messageVariable,
135 correlationVariable, correlationValue, logMarker);
138 @WebMethod(operationName = "createVnfNotification")
140 @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
141 @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
142 public void createVnfNotification(
143 @WebParam(name = "messageId", targetNamespace = "")
145 @WebParam(name = "completed", targetNamespace = "")
147 @WebParam(name = "exception", targetNamespace = "")
148 MsoExceptionCategory exception,
149 @WebParam(name = "errorMessage", targetNamespace = "")
151 @WebParam(name = "vnfId", targetNamespace = "")
153 @WebParam(name = "outputs", targetNamespace = "")
154 CreateVnfNotification.Outputs outputs,
155 @WebParam(name = "rollback", targetNamespace = "")
156 VnfRollback rollback){
158 String method = "createVnfNotification";
159 String messageEventName = "createVnfNotificationCallback";
160 String messageVariable = "createVnfNotificationCallback";
161 String correlationVariable = "VNFC_messageId";
162 String correlationValue = messageId;
164 MsoLogger.setLogContext(correlationValue, "N/A");
166 CreateVnfNotification message = new CreateVnfNotification();
168 message.setMessageId(messageId);
169 message.setCompleted(completed);
170 message.setException(exception);
171 message.setErrorMessage(errorMessage);
172 message.setVnfId(vnfId);
173 message.setOutputs(outputs);
174 message.setRollback(rollback);
176 callback.handleCallback(method, message, messageEventName, messageVariable,
177 correlationVariable, correlationValue, logMarker);
180 @WebMethod(operationName = "updateVnfNotification")
182 @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
183 @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest")
184 public void updateVnfNotification(
185 @WebParam(name = "messageId", targetNamespace = "")
187 @WebParam(name = "completed", targetNamespace = "")
189 @WebParam(name = "exception", targetNamespace = "")
190 MsoExceptionCategory exception,
191 @WebParam(name = "errorMessage", targetNamespace = "")
193 @WebParam(name = "outputs", targetNamespace = "")
194 UpdateVnfNotification.Outputs outputs,
195 @WebParam(name = "rollback", targetNamespace = "")
196 VnfRollback rollback){
198 String method = "updateVnfNotification";
199 String messageEventName = "updateVnfNotificationCallback";
200 String messageVariable = "updateVnfNotificationCallback";
201 String correlationVariable = "VNFU_messageId";
202 String correlationValue = messageId;
204 MsoLogger.setLogContext(correlationValue, "N/A");
206 UpdateVnfNotification message = new UpdateVnfNotification();
208 message.setMessageId(messageId);
209 message.setCompleted(completed);
210 message.setException(exception);
211 message.setErrorMessage(errorMessage);
212 message.setOutputs(outputs);
213 message.setRollback(rollback);
215 callback.handleCallback(method, message, messageEventName, messageVariable,
216 correlationVariable, correlationValue, logMarker);
219 @WebMethod(operationName = "deleteVnfNotification")
221 @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
222 @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
223 public void deleteVnfNotification(
224 @WebParam(name = "messageId", targetNamespace = "")
226 @WebParam(name = "completed", targetNamespace = "")
228 @WebParam(name = "exception", targetNamespace = "")
229 MsoExceptionCategory exception,
230 @WebParam(name = "errorMessage", targetNamespace = "")
231 String errorMessage) {
233 String method = "deleteVnfNotification";
234 String messageEventName = "deleteVnfACallback";
235 String messageVariable = "deleteVnfACallback";
236 String correlationVariable = "VNFDEL_uuid";
237 String correlationValue = messageId;
239 MsoLogger.setLogContext(correlationValue, "N/A");
241 DeleteVnfNotification message = new DeleteVnfNotification();
243 message.setMessageId(messageId);
244 message.setCompleted(completed);
245 message.setException(exception);
246 message.setErrorMessage(errorMessage);
248 callback.handleCallback(method, message, messageEventName, messageVariable,
249 correlationVariable, correlationValue, logMarker);