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.springframework.beans.factory.annotation.Autowired;
44 import org.springframework.stereotype.Service;
47 * Implementation of the VnfAdapterNotify service.
49 @WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
51 public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{
53 private final String logMarker = "[VNF-NOTIFY]";
56 CallbackHandlerService callback;
58 @Context WebServiceContext wsContext;
60 @WebMethod(operationName = "rollbackVnfNotification")
62 @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
63 @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest")
64 public void rollbackVnfNotification(
65 @WebParam(name = "messageId", targetNamespace = "")
67 @WebParam(name = "completed", targetNamespace = "")
69 @WebParam(name = "exception", targetNamespace = "")
70 MsoExceptionCategory exception,
71 @WebParam(name = "errorMessage", targetNamespace = "")
72 String errorMessage) {
74 RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
76 rollbackVnfNotification.setMessageId(messageId);
77 rollbackVnfNotification.setCompleted(completed);
78 rollbackVnfNotification.setException(exception);
79 rollbackVnfNotification.setErrorMessage(errorMessage);
81 String method = "rollbackVnfNotification";
82 Object message = rollbackVnfNotification;
83 String messageEventName = "rollbackVnfNotificationCallback";
84 String messageVariable = "rollbackVnfNotificationCallback";
85 String correlationVariable = "VNFRB_messageId";
86 String correlationValue = messageId;
88 callback.handleCallback(method, message, messageEventName, messageVariable,
89 correlationVariable, correlationValue, logMarker);
92 @WebMethod(operationName = "queryVnfNotification")
94 @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
95 @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest")
96 public void queryVnfNotification(
97 @WebParam(name = "messageId", targetNamespace = "")
99 @WebParam(name = "completed", targetNamespace = "")
101 @WebParam(name = "exception", targetNamespace = "")
102 MsoExceptionCategory exception,
103 @WebParam(name = "errorMessage", targetNamespace = "")
105 @WebParam(name = "vnfExists", targetNamespace = "")
107 @WebParam(name = "vnfId", targetNamespace = "")
109 @WebParam(name = "status", targetNamespace = "")
111 @WebParam(name = "outputs", targetNamespace = "")
112 QueryVnfNotification.Outputs outputs){
114 String method = "queryVnfNotification";
115 String messageEventName = "queryVnfNotificationCallback";
116 String messageVariable = "queryVnfNotificationCallback";
117 String correlationVariable = "VNFQ_messageId";
118 String correlationValue = messageId;
120 QueryVnfNotification message = new QueryVnfNotification();
122 message.setMessageId(messageId);
123 message.setCompleted(completed);
124 message.setException(exception);
125 message.setErrorMessage(errorMessage);
126 message.setVnfExists(vnfExists);
127 message.setVnfId(vnfId);
128 message.setStatus(status);
129 message.setOutputs(outputs);
131 callback.handleCallback(method, message, messageEventName, messageVariable,
132 correlationVariable, correlationValue, logMarker);
135 @WebMethod(operationName = "createVnfNotification")
137 @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
138 @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
139 public void createVnfNotification(
140 @WebParam(name = "messageId", targetNamespace = "")
142 @WebParam(name = "completed", targetNamespace = "")
144 @WebParam(name = "exception", targetNamespace = "")
145 MsoExceptionCategory exception,
146 @WebParam(name = "errorMessage", targetNamespace = "")
148 @WebParam(name = "vnfId", targetNamespace = "")
150 @WebParam(name = "outputs", targetNamespace = "")
151 CreateVnfNotification.Outputs outputs,
152 @WebParam(name = "rollback", targetNamespace = "")
153 VnfRollback rollback){
155 String method = "createVnfNotification";
156 String messageEventName = "createVnfNotificationCallback";
157 String messageVariable = "createVnfNotificationCallback";
158 String correlationVariable = "VNFC_messageId";
159 String correlationValue = messageId;
161 CreateVnfNotification message = new CreateVnfNotification();
163 message.setMessageId(messageId);
164 message.setCompleted(completed);
165 message.setException(exception);
166 message.setErrorMessage(errorMessage);
167 message.setVnfId(vnfId);
168 message.setOutputs(outputs);
169 message.setRollback(rollback);
171 callback.handleCallback(method, message, messageEventName, messageVariable,
172 correlationVariable, correlationValue, logMarker);
175 @WebMethod(operationName = "updateVnfNotification")
177 @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
178 @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest")
179 public void updateVnfNotification(
180 @WebParam(name = "messageId", targetNamespace = "")
182 @WebParam(name = "completed", targetNamespace = "")
184 @WebParam(name = "exception", targetNamespace = "")
185 MsoExceptionCategory exception,
186 @WebParam(name = "errorMessage", targetNamespace = "")
188 @WebParam(name = "outputs", targetNamespace = "")
189 UpdateVnfNotification.Outputs outputs,
190 @WebParam(name = "rollback", targetNamespace = "")
191 VnfRollback rollback){
193 String method = "updateVnfNotification";
194 String messageEventName = "updateVnfNotificationCallback";
195 String messageVariable = "updateVnfNotificationCallback";
196 String correlationVariable = "VNFU_messageId";
197 String correlationValue = messageId;
199 UpdateVnfNotification message = new UpdateVnfNotification();
201 message.setMessageId(messageId);
202 message.setCompleted(completed);
203 message.setException(exception);
204 message.setErrorMessage(errorMessage);
205 message.setOutputs(outputs);
206 message.setRollback(rollback);
208 callback.handleCallback(method, message, messageEventName, messageVariable,
209 correlationVariable, correlationValue, logMarker);
212 @WebMethod(operationName = "deleteVnfNotification")
214 @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
215 @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
216 public void deleteVnfNotification(
217 @WebParam(name = "messageId", targetNamespace = "")
219 @WebParam(name = "completed", targetNamespace = "")
221 @WebParam(name = "exception", targetNamespace = "")
222 MsoExceptionCategory exception,
223 @WebParam(name = "errorMessage", targetNamespace = "")
224 String errorMessage) {
226 String method = "deleteVnfNotification";
227 String messageEventName = "deleteVnfACallback";
228 String messageVariable = "deleteVnfACallback";
229 String correlationVariable = "VNFDEL_uuid";
230 String correlationValue = messageId;
232 DeleteVnfNotification message = new DeleteVnfNotification();
234 message.setMessageId(messageId);
235 message.setCompleted(completed);
236 message.setException(exception);
237 message.setErrorMessage(errorMessage);
239 callback.handleCallback(method, message, messageEventName, messageVariable,
240 correlationVariable, correlationValue, logMarker);