2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.common.workflow.service;
23 import javax.jws.Oneway;
24 import javax.jws.WebMethod;
25 import javax.jws.WebParam;
26 import javax.jws.WebService;
27 import javax.ws.rs.core.Context;
28 import javax.xml.ws.Action;
29 import javax.xml.ws.RequestWrapper;
30 import javax.xml.ws.WebServiceContext;
32 import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
33 import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
34 import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
35 import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification;
36 import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification;
37 import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
38 import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify;
39 import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
40 import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
41 import org.onap.so.logger.MsoLogger;
42 import org.springframework.beans.factory.annotation.Autowired;
43 import org.springframework.stereotype.Service;
46 * Implementation of the VnfAdapterNotify service.
48 @WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
50 public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{
52 private final String logMarker = "[VNF-NOTIFY]";
55 CallbackHandlerService callback;
57 @Context WebServiceContext wsContext;
59 @WebMethod(operationName = "rollbackVnfNotification")
61 @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
62 @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest")
63 public void rollbackVnfNotification(
64 @WebParam(name = "messageId", targetNamespace = "")
66 @WebParam(name = "completed", targetNamespace = "")
68 @WebParam(name = "exception", targetNamespace = "")
69 MsoExceptionCategory exception,
70 @WebParam(name = "errorMessage", targetNamespace = "")
71 String errorMessage) {
73 RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
75 rollbackVnfNotification.setMessageId(messageId);
76 rollbackVnfNotification.setCompleted(completed);
77 rollbackVnfNotification.setException(exception);
78 rollbackVnfNotification.setErrorMessage(errorMessage);
80 String method = "rollbackVnfNotification";
81 Object message = rollbackVnfNotification;
82 String messageEventName = "rollbackVnfNotificationCallback";
83 String messageVariable = "rollbackVnfNotificationCallback";
84 String correlationVariable = "VNFRB_messageId";
85 String correlationValue = messageId;
87 callback.handleCallback(method, message, messageEventName, messageVariable,
88 correlationVariable, correlationValue, logMarker);
91 @WebMethod(operationName = "queryVnfNotification")
93 @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
94 @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest")
95 public void queryVnfNotification(
96 @WebParam(name = "messageId", targetNamespace = "")
98 @WebParam(name = "completed", targetNamespace = "")
100 @WebParam(name = "exception", targetNamespace = "")
101 MsoExceptionCategory exception,
102 @WebParam(name = "errorMessage", targetNamespace = "")
104 @WebParam(name = "vnfExists", targetNamespace = "")
106 @WebParam(name = "vnfId", targetNamespace = "")
108 @WebParam(name = "status", targetNamespace = "")
110 @WebParam(name = "outputs", targetNamespace = "")
111 QueryVnfNotification.Outputs outputs){
113 String method = "queryVnfNotification";
114 String messageEventName = "queryVnfNotificationCallback";
115 String messageVariable = "queryVnfNotificationCallback";
116 String correlationVariable = "VNFQ_messageId";
117 String correlationValue = messageId;
119 MsoLogger.setServiceName("MSO." + method);
120 MsoLogger.setLogContext(correlationValue, "N/A");
122 QueryVnfNotification message = new QueryVnfNotification();
124 message.setMessageId(messageId);
125 message.setCompleted(completed);
126 message.setException(exception);
127 message.setErrorMessage(errorMessage);
128 message.setVnfExists(vnfExists);
129 message.setVnfId(vnfId);
130 message.setStatus(status);
131 message.setOutputs(outputs);
133 callback.handleCallback(method, message, messageEventName, messageVariable,
134 correlationVariable, correlationValue, logMarker);
137 @WebMethod(operationName = "createVnfNotification")
139 @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
140 @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
141 public void createVnfNotification(
142 @WebParam(name = "messageId", targetNamespace = "")
144 @WebParam(name = "completed", targetNamespace = "")
146 @WebParam(name = "exception", targetNamespace = "")
147 MsoExceptionCategory exception,
148 @WebParam(name = "errorMessage", targetNamespace = "")
150 @WebParam(name = "vnfId", targetNamespace = "")
152 @WebParam(name = "outputs", targetNamespace = "")
153 CreateVnfNotification.Outputs outputs,
154 @WebParam(name = "rollback", targetNamespace = "")
155 VnfRollback rollback){
157 String method = "createVnfNotification";
158 String messageEventName = "createVnfNotificationCallback";
159 String messageVariable = "createVnfNotificationCallback";
160 String correlationVariable = "VNFC_messageId";
161 String correlationValue = messageId;
163 MsoLogger.setServiceName("MSO." + method);
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.setServiceName("MSO." + method);
205 MsoLogger.setLogContext(correlationValue, "N/A");
207 UpdateVnfNotification message = new UpdateVnfNotification();
209 message.setMessageId(messageId);
210 message.setCompleted(completed);
211 message.setException(exception);
212 message.setErrorMessage(errorMessage);
213 message.setOutputs(outputs);
214 message.setRollback(rollback);
216 callback.handleCallback(method, message, messageEventName, messageVariable,
217 correlationVariable, correlationValue, logMarker);
220 @WebMethod(operationName = "deleteVnfNotification")
222 @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
223 @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
224 public void deleteVnfNotification(
225 @WebParam(name = "messageId", targetNamespace = "")
227 @WebParam(name = "completed", targetNamespace = "")
229 @WebParam(name = "exception", targetNamespace = "")
230 MsoExceptionCategory exception,
231 @WebParam(name = "errorMessage", targetNamespace = "")
232 String errorMessage) {
234 String method = "deleteVnfNotification";
235 String messageEventName = "deleteVnfACallback";
236 String messageVariable = "deleteVnfACallback";
237 String correlationVariable = "VNFDEL_uuid";
238 String correlationValue = messageId;
240 MsoLogger.setServiceName("MSO." + method);
241 MsoLogger.setLogContext(correlationValue, "N/A");
243 DeleteVnfNotification message = new DeleteVnfNotification();
245 message.setMessageId(messageId);
246 message.setCompleted(completed);
247 message.setException(exception);
248 message.setErrorMessage(errorMessage);
250 callback.handleCallback(method, message, messageEventName, messageVariable,
251 correlationVariable, correlationValue, logMarker);