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;
33 import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
34 import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
35 import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
36 import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification;
37 import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification;
38 import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
39 import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify;
40 import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
41 import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
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;
58 WebServiceContext wsContext;
60 @WebMethod(operationName = "rollbackVnfNotification")
62 @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
63 className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
64 @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest")
65 public void rollbackVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
66 @WebParam(name = "completed", targetNamespace = "") boolean completed,
67 @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
68 @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage) {
70 RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
72 rollbackVnfNotification.setMessageId(messageId);
73 rollbackVnfNotification.setCompleted(completed);
74 rollbackVnfNotification.setException(exception);
75 rollbackVnfNotification.setErrorMessage(errorMessage);
77 String method = "rollbackVnfNotification";
78 Object message = rollbackVnfNotification;
79 String messageEventName = "rollbackVnfNotificationCallback";
80 String messageVariable = "rollbackVnfNotificationCallback";
81 String correlationVariable = "VNFRB_messageId";
82 String correlationValue = messageId;
84 callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
85 correlationValue, logMarker);
88 @WebMethod(operationName = "queryVnfNotification")
90 @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
91 className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
92 @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest")
93 public void queryVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
94 @WebParam(name = "completed", targetNamespace = "") boolean completed,
95 @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
96 @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
97 @WebParam(name = "vnfExists", targetNamespace = "") Boolean vnfExists,
98 @WebParam(name = "vnfId", targetNamespace = "") String vnfId,
99 @WebParam(name = "status", targetNamespace = "") VnfStatus status,
100 @WebParam(name = "outputs", targetNamespace = "") QueryVnfNotification.Outputs outputs) {
102 String method = "queryVnfNotification";
103 String messageEventName = "queryVnfNotificationCallback";
104 String messageVariable = "queryVnfNotificationCallback";
105 String correlationVariable = "VNFQ_messageId";
106 String correlationValue = messageId;
108 QueryVnfNotification message = new QueryVnfNotification();
110 message.setMessageId(messageId);
111 message.setCompleted(completed);
112 message.setException(exception);
113 message.setErrorMessage(errorMessage);
114 message.setVnfExists(vnfExists);
115 message.setVnfId(vnfId);
116 message.setStatus(status);
117 message.setOutputs(outputs);
119 callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
120 correlationValue, logMarker);
123 @WebMethod(operationName = "createVnfNotification")
125 @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
126 className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
127 @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
128 public void createVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
129 @WebParam(name = "completed", targetNamespace = "") boolean completed,
130 @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
131 @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
132 @WebParam(name = "vnfId", targetNamespace = "") String vnfId,
133 @WebParam(name = "outputs", targetNamespace = "") CreateVnfNotification.Outputs outputs,
134 @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback) {
136 String method = "createVnfNotification";
137 String messageEventName = "createVnfNotificationCallback";
138 String messageVariable = "createVnfNotificationCallback";
139 String correlationVariable = "VNFC_messageId";
140 String correlationValue = messageId;
142 CreateVnfNotification message = new CreateVnfNotification();
144 message.setMessageId(messageId);
145 message.setCompleted(completed);
146 message.setException(exception);
147 message.setErrorMessage(errorMessage);
148 message.setVnfId(vnfId);
149 message.setOutputs(outputs);
150 message.setRollback(rollback);
152 callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
153 correlationValue, logMarker);
156 @WebMethod(operationName = "updateVnfNotification")
158 @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
159 className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
160 @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest")
161 public void updateVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
162 @WebParam(name = "completed", targetNamespace = "") boolean completed,
163 @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
164 @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
165 @WebParam(name = "outputs", targetNamespace = "") UpdateVnfNotification.Outputs outputs,
166 @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback) {
168 String method = "updateVnfNotification";
169 String messageEventName = "updateVnfNotificationCallback";
170 String messageVariable = "updateVnfNotificationCallback";
171 String correlationVariable = "VNFU_messageId";
172 String correlationValue = messageId;
174 UpdateVnfNotification message = new UpdateVnfNotification();
176 message.setMessageId(messageId);
177 message.setCompleted(completed);
178 message.setException(exception);
179 message.setErrorMessage(errorMessage);
180 message.setOutputs(outputs);
181 message.setRollback(rollback);
183 callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
184 correlationValue, logMarker);
187 @WebMethod(operationName = "deleteVnfNotification")
189 @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
190 className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
191 @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
192 public void deleteVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
193 @WebParam(name = "completed", targetNamespace = "") boolean completed,
194 @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
195 @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage) {
197 String method = "deleteVnfNotification";
198 String messageEventName = "deleteVnfACallback";
199 String messageVariable = "deleteVnfACallback";
200 String correlationVariable = "VNFDEL_uuid";
201 String correlationValue = messageId;
203 DeleteVnfNotification message = new DeleteVnfNotification();
205 message.setMessageId(messageId);
206 message.setCompleted(completed);
207 message.setException(exception);
208 message.setErrorMessage(errorMessage);
210 callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
211 correlationValue, logMarker);