Removed MsoLogger class
[so.git] / bpmn / mso-infrastructure-bpmn / src / main / java / org / onap / so / bpmn / common / workflow / service / VnfAdapterNotifyServiceImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
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=========================================================
21  */
22
23 package org.onap.so.bpmn.common.workflow.service;
24
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
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;
45
46 /**
47  * Implementation of the VnfAdapterNotify service.
48  */
49 @WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
50 @Service
51 public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{
52
53         private final String logMarker = "[VNF-NOTIFY]";
54         
55         @Autowired
56         CallbackHandlerService callback;
57
58         @Context WebServiceContext wsContext;
59
60     @WebMethod(operationName = "rollbackVnfNotification")
61     @Oneway
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 = "")
66         String messageId,
67         @WebParam(name = "completed", targetNamespace = "")
68         boolean completed,
69         @WebParam(name = "exception", targetNamespace = "")
70         MsoExceptionCategory exception,
71         @WebParam(name = "errorMessage", targetNamespace = "")
72         String errorMessage) {
73
74                 RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
75
76                 rollbackVnfNotification.setMessageId(messageId);
77                 rollbackVnfNotification.setCompleted(completed);
78                 rollbackVnfNotification.setException(exception);
79                 rollbackVnfNotification.setErrorMessage(errorMessage);
80
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;
87
88                 callback.handleCallback(method, message, messageEventName, messageVariable,
89                         correlationVariable, correlationValue, logMarker);
90     }
91
92     @WebMethod(operationName = "queryVnfNotification")
93     @Oneway
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 = "")
98         String messageId,
99         @WebParam(name = "completed", targetNamespace = "")
100         boolean completed,
101         @WebParam(name = "exception", targetNamespace = "")
102         MsoExceptionCategory exception,
103         @WebParam(name = "errorMessage", targetNamespace = "")
104         String errorMessage,
105         @WebParam(name = "vnfExists", targetNamespace = "")
106         Boolean vnfExists,
107         @WebParam(name = "vnfId", targetNamespace = "")
108         String vnfId,
109         @WebParam(name = "status", targetNamespace = "")
110         VnfStatus status,
111         @WebParam(name = "outputs", targetNamespace = "")
112         QueryVnfNotification.Outputs outputs){
113
114                 String method = "queryVnfNotification";
115                 String messageEventName = "queryVnfNotificationCallback";
116                 String messageVariable = "queryVnfNotificationCallback";
117                 String correlationVariable = "VNFQ_messageId";
118                 String correlationValue = messageId;
119
120         QueryVnfNotification message = new QueryVnfNotification();
121
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);
130
131         callback.handleCallback(method, message, messageEventName, messageVariable,
132                         correlationVariable, correlationValue, logMarker);
133     }
134
135         @WebMethod(operationName = "createVnfNotification")
136     @Oneway
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 = "")
141                 String messageId,
142                 @WebParam(name = "completed", targetNamespace = "")
143                 boolean completed,
144                 @WebParam(name = "exception", targetNamespace = "")
145                 MsoExceptionCategory exception,
146                 @WebParam(name = "errorMessage", targetNamespace = "")
147                 String errorMessage,
148                 @WebParam(name = "vnfId", targetNamespace = "")
149                 String vnfId,
150                 @WebParam(name = "outputs", targetNamespace = "")
151                 CreateVnfNotification.Outputs outputs,
152                 @WebParam(name = "rollback", targetNamespace = "")
153                 VnfRollback rollback){
154
155                 String method = "createVnfNotification";
156                 String messageEventName = "createVnfNotificationCallback";
157                 String messageVariable = "createVnfNotificationCallback";
158                 String correlationVariable = "VNFC_messageId";
159                 String correlationValue = messageId;
160
161                 CreateVnfNotification message = new CreateVnfNotification();
162
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);
170
171                 callback.handleCallback(method, message, messageEventName, messageVariable,
172                         correlationVariable, correlationValue, logMarker);
173          }
174
175         @WebMethod(operationName = "updateVnfNotification")
176     @Oneway
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 = "")
181         String messageId,
182         @WebParam(name = "completed", targetNamespace = "")
183         boolean completed,
184         @WebParam(name = "exception", targetNamespace = "")
185         MsoExceptionCategory exception,
186         @WebParam(name = "errorMessage", targetNamespace = "")
187         String errorMessage,
188         @WebParam(name = "outputs", targetNamespace = "")
189         UpdateVnfNotification.Outputs outputs,
190         @WebParam(name = "rollback", targetNamespace = "")
191         VnfRollback rollback){
192
193                 String method = "updateVnfNotification";
194                 String messageEventName = "updateVnfNotificationCallback";
195                 String messageVariable = "updateVnfNotificationCallback";
196                 String correlationVariable = "VNFU_messageId";
197                 String correlationValue = messageId;
198
199         UpdateVnfNotification message = new UpdateVnfNotification();
200
201         message.setMessageId(messageId);
202         message.setCompleted(completed);
203         message.setException(exception);
204         message.setErrorMessage(errorMessage);
205         message.setOutputs(outputs);
206         message.setRollback(rollback);
207
208         callback.handleCallback(method, message, messageEventName, messageVariable,
209                         correlationVariable, correlationValue, logMarker);
210          }
211
212     @WebMethod(operationName = "deleteVnfNotification")
213     @Oneway
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 = "")
218         String messageId,
219         @WebParam(name = "completed", targetNamespace = "")
220         boolean completed,
221         @WebParam(name = "exception", targetNamespace = "")
222         MsoExceptionCategory exception,
223         @WebParam(name = "errorMessage", targetNamespace = "")
224         String errorMessage) {
225
226                 String method = "deleteVnfNotification";
227                 String messageEventName = "deleteVnfACallback";
228                 String messageVariable = "deleteVnfACallback";
229                 String correlationVariable = "VNFDEL_uuid";
230                 String correlationValue = messageId;
231
232         DeleteVnfNotification message = new DeleteVnfNotification();
233
234         message.setMessageId(messageId);
235         message.setCompleted(completed);
236         message.setException(exception);
237         message.setErrorMessage(errorMessage);
238
239         callback.handleCallback(method, message, messageEventName, messageVariable,
240                         correlationVariable, correlationValue, logMarker);
241         }
242 }