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 static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterNotifyServiceImpl.class);
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.setServiceName("MSO." + method);
122 MsoLogger.setLogContext(correlationValue, "N/A");
124 QueryVnfNotification message = new QueryVnfNotification();
126 message.setMessageId(messageId);
127 message.setCompleted(completed);
128 message.setException(exception);
129 message.setErrorMessage(errorMessage);
130 message.setVnfExists(vnfExists);
131 message.setVnfId(vnfId);
132 message.setStatus(status);
133 message.setOutputs(outputs);
135 callback.handleCallback(method, message, messageEventName, messageVariable,
136 correlationVariable, correlationValue, logMarker);
139 @WebMethod(operationName = "createVnfNotification")
141 @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
142 @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
143 public void createVnfNotification(
144 @WebParam(name = "messageId", targetNamespace = "")
146 @WebParam(name = "completed", targetNamespace = "")
148 @WebParam(name = "exception", targetNamespace = "")
149 MsoExceptionCategory exception,
150 @WebParam(name = "errorMessage", targetNamespace = "")
152 @WebParam(name = "vnfId", targetNamespace = "")
154 @WebParam(name = "outputs", targetNamespace = "")
155 CreateVnfNotification.Outputs outputs,
156 @WebParam(name = "rollback", targetNamespace = "")
157 VnfRollback rollback){
159 String method = "createVnfNotification";
160 String messageEventName = "createVnfNotificationCallback";
161 String messageVariable = "createVnfNotificationCallback";
162 String correlationVariable = "VNFC_messageId";
163 String correlationValue = messageId;
165 MsoLogger.setServiceName("MSO." + method);
166 MsoLogger.setLogContext(correlationValue, "N/A");
168 CreateVnfNotification message = new CreateVnfNotification();
170 message.setMessageId(messageId);
171 message.setCompleted(completed);
172 message.setException(exception);
173 message.setErrorMessage(errorMessage);
174 message.setVnfId(vnfId);
175 message.setOutputs(outputs);
176 message.setRollback(rollback);
178 callback.handleCallback(method, message, messageEventName, messageVariable,
179 correlationVariable, correlationValue, logMarker);
182 @WebMethod(operationName = "updateVnfNotification")
184 @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
185 @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest")
186 public void updateVnfNotification(
187 @WebParam(name = "messageId", targetNamespace = "")
189 @WebParam(name = "completed", targetNamespace = "")
191 @WebParam(name = "exception", targetNamespace = "")
192 MsoExceptionCategory exception,
193 @WebParam(name = "errorMessage", targetNamespace = "")
195 @WebParam(name = "outputs", targetNamespace = "")
196 UpdateVnfNotification.Outputs outputs,
197 @WebParam(name = "rollback", targetNamespace = "")
198 VnfRollback rollback){
200 String method = "updateVnfNotification";
201 String messageEventName = "updateVnfNotificationCallback";
202 String messageVariable = "updateVnfNotificationCallback";
203 String correlationVariable = "VNFU_messageId";
204 String correlationValue = messageId;
206 MsoLogger.setServiceName("MSO." + method);
207 MsoLogger.setLogContext(correlationValue, "N/A");
209 UpdateVnfNotification message = new UpdateVnfNotification();
211 message.setMessageId(messageId);
212 message.setCompleted(completed);
213 message.setException(exception);
214 message.setErrorMessage(errorMessage);
215 message.setOutputs(outputs);
216 message.setRollback(rollback);
218 callback.handleCallback(method, message, messageEventName, messageVariable,
219 correlationVariable, correlationValue, logMarker);
222 @WebMethod(operationName = "deleteVnfNotification")
224 @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
225 @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
226 public void deleteVnfNotification(
227 @WebParam(name = "messageId", targetNamespace = "")
229 @WebParam(name = "completed", targetNamespace = "")
231 @WebParam(name = "exception", targetNamespace = "")
232 MsoExceptionCategory exception,
233 @WebParam(name = "errorMessage", targetNamespace = "")
234 String errorMessage) {
236 String method = "deleteVnfNotification";
237 String messageEventName = "deleteVnfACallback";
238 String messageVariable = "deleteVnfACallback";
239 String correlationVariable = "VNFDEL_uuid";
240 String correlationValue = messageId;
242 MsoLogger.setServiceName("MSO." + method);
243 MsoLogger.setLogContext(correlationValue, "N/A");
245 DeleteVnfNotification message = new DeleteVnfNotification();
247 message.setMessageId(messageId);
248 message.setCompleted(completed);
249 message.setException(exception);
250 message.setErrorMessage(errorMessage);
252 callback.handleCallback(method, message, messageEventName, messageVariable,
253 correlationVariable, correlationValue, logMarker);