Initial OpenECOMP MSO commit
[so.git] / bpmn / MSOGammaBPMN / src / main / java / org / openecomp / mso / bpmn / gamma / workflow / service / VnfAdapterNotifyServiceImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * OPENECOMP - MSO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.mso.bpmn.gamma.workflow.service;
22
23 import java.util.HashMap;
24 import java.util.Map;
25
26 import javax.jws.Oneway;
27 import javax.jws.WebMethod;
28 import javax.jws.WebParam;
29 import javax.jws.WebService;
30 import javax.ws.rs.core.Context;
31 import javax.xml.ws.Action;
32 import javax.xml.ws.RequestWrapper;
33 import javax.xml.ws.WebServiceContext;
34
35 import org.camunda.bpm.BpmPlatform;
36 import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
37 import org.camunda.bpm.engine.ProcessEngineServices;
38 import org.camunda.bpm.engine.RuntimeService;
39
40 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.CreateVnfNotification;
41 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.DeleteVnfNotification;
42 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.MsoExceptionCategory;
43 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.QueryVnfNotification;
44 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.RollbackVnfNotification;
45 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.UpdateVnfNotification;
46 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.VnfAdapterNotify;
47 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.VnfRollback;
48 import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.VnfStatus;
49 import org.openecomp.mso.logger.MessageEnum;
50 import org.openecomp.mso.logger.MsoLogger;
51
52 /**
53  * This is the service class for VnfAdapterNotify
54  * TODO: Add addition VnfAdapterNotify Methods for remaining VnfAdapterNotify operations.
55  */
56
57 @WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://com.att.mso/vnfNotify")
58 public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{
59
60         private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
61
62         private final String logMarker = "[VNF-NOTIFY]";
63
64         @Context WebServiceContext wsContext;
65
66         private volatile ProcessEngineServices pes4junit = null;
67
68     /**
69      *
70      * @param errorMessage
71      * @param exception
72      * @param messageId
73      * @param completed
74      */
75     @WebMethod(operationName = "rollbackVnfNotification")
76     @Oneway
77     @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification")
78     @Action(input = "http://com.att.mso/notify/adapterNotify/rollbackVnfNotificationRequest")
79     public void rollbackVnfNotification(
80         @WebParam(name = "messageId", targetNamespace = "")
81         String messageId,
82         @WebParam(name = "completed", targetNamespace = "")
83         boolean completed,
84         @WebParam(name = "exception", targetNamespace = "")
85         MsoExceptionCategory exception,
86         @WebParam(name = "errorMessage", targetNamespace = "")
87         String errorMessage) {
88
89
90
91                 RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
92
93                 rollbackVnfNotification.setMessageId(messageId);
94                 rollbackVnfNotification.setCompleted(completed);
95                 rollbackVnfNotification.setException(exception);
96                 rollbackVnfNotification.setErrorMessage(errorMessage);
97
98                 ProcessEngineServices pes = getProcessEngineServices();
99                 RuntimeService runtimeService = pes.getRuntimeService();
100
101                 MsoLogger.setServiceName("MSO." + "vnfAdapterRollback");
102                 MsoLogger.setLogContext(messageId, "N/A");
103                 msoLogger.debug(logMarker + "Received RollbackVnfNotification" + rollbackVnfNotification.toString());
104
105                 long startTime = System.currentTimeMillis();
106                 try {
107
108                         /* Check to make sure the process instance is ready for correlation*/
109                         isReadyforCorrelation(runtimeService, messageId, "rollbackVnfNotificationCallback", "VNFRB_messageId");
110
111                         msoLogger.debug(logMarker + "*** Received MSO rollbackVnfNotification Callback ******");                        
112                         msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService ");                      
113                         msoLogger.debug(logMarker + "Rollback VNF Notification string:\n"  + rollbackVnfNotification.toString());
114
115                         System.out.println("testing ROllbackVnfNotification : " + rollbackVnfNotification.toString());
116
117                         Map<String,Object> variables = new HashMap<String,Object>();
118                         variables.put("VNFRB_messageId", messageId );
119                         variables.put("rollbackVnfNotificationCallback", rollbackVnfNotification.toString());
120
121                         /*Correlating the response with the running instance*/
122
123                         runtimeService.createMessageCorrelation("rollbackVnfNotificationCallback").setVariables(variables)
124                                   .processInstanceVariableEquals("VNFRB_messageId", messageId).correlate();
125
126                         msoLogger.debug(logMarker + "***** Completed processing of MSO VnfAdapterNotifyService ******");
127                 } catch(MismatchingMessageCorrelationException e) {
128                         msoLogger.debug(logMarker + "[CORM]correlation id mismatch");
129                         String msg =
130                                 "VNF Adapter Notify Service received a Create VNF Notification request with RequestId '"
131                                 + messageId
132                                 + "' but that RequestId could not be correlated to any active process - ignoring the request";
133                         
134                         msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), 
135                                         MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg);
136                         
137                 }               
138                 msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
139                                 logMarker + "Completed the execution of MSO Vnf Adapter Notify for Rollback VNF Notification.");
140                 
141                 msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
142                                 logMarker + "Completed the execution of MSO Vnf Adapter Notify for Rollback VNF Notification.", "BPMN", 
143                                 MsoLogger.getServiceName(), "rollbackVnfNotification");
144                 
145                 return;
146          }
147
148
149
150     /**
151      *
152      * @param errorMessage
153      * @param vnfExists
154      * @param status
155      * @param exception
156      * @param outputs
157      * @param messageId
158      * @param vnfId
159      * @param completed
160      */
161     @WebMethod(operationName = "queryVnfNotification")
162     @Oneway
163     @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification")
164     @Action(input = "http://com.att.mso/notify/adapterNotify/queryVnfNotificationRequest")
165     public void queryVnfNotification(
166         @WebParam(name = "messageId", targetNamespace = "")
167         String messageId,
168         @WebParam(name = "completed", targetNamespace = "")
169         boolean completed,
170         @WebParam(name = "exception", targetNamespace = "")
171         MsoExceptionCategory exception,
172         @WebParam(name = "errorMessage", targetNamespace = "")
173         String errorMessage,
174         @WebParam(name = "vnfExists", targetNamespace = "")
175         Boolean vnfExists,
176         @WebParam(name = "vnfId", targetNamespace = "")
177         String vnfId,
178         @WebParam(name = "status", targetNamespace = "")
179         VnfStatus status,
180         @WebParam(name = "outputs", targetNamespace = "")
181         com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.QueryVnfNotification.Outputs outputs){
182
183         QueryVnfNotification queryVnfNotification = new QueryVnfNotification();
184
185         queryVnfNotification.setMessageId(messageId);
186         queryVnfNotification.setCompleted(completed);
187         queryVnfNotification.setException(exception);
188         queryVnfNotification.setErrorMessage(errorMessage);
189         queryVnfNotification.setVnfExists(vnfExists);
190         queryVnfNotification.setVnfId(vnfId);
191         queryVnfNotification.setStatus(status);
192         queryVnfNotification.setOutputs(outputs);
193
194
195         ProcessEngineServices pes = getProcessEngineServices();
196                 RuntimeService runtimeService = pes.getRuntimeService();
197
198                 msoLogger.setServiceName("MSO." + "vnf Adapter Query");
199                 msoLogger.setLogContext(messageId, "N/A");
200                 msoLogger.debug(logMarker + "Received QueryVnfNotification" + queryVnfNotification.toString());
201
202                 System.out.println("Received QueryVnfNotification : " + queryVnfNotification.toString());
203
204                 long startTime = System.currentTimeMillis();
205                 try {
206
207                         /* Check to make sure the process instance is ready for correlation*/
208                         isReadyforCorrelation(runtimeService, messageId, "queryVnfNotificationCallback", "VNFQ_messageId");
209
210                         msoLogger.debug(logMarker + "*** Received MSO queryVnfNotification Callback ******");
211                         msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService ");
212                         msoLogger.debug(logMarker + "Query VNF Notification string:\n"  + queryVnfNotification.toString());
213
214                         Map<String,Object> variables = new HashMap<String,Object>();
215                         variables.put("VNFQ_messageId", messageId );
216                         variables.put("queryVnfNotificationCallback", queryVnfNotification.toString());
217
218                         /*Correlating the response with the running instance*/
219
220                         runtimeService.createMessageCorrelation("queryVnfNotificationCallback").setVariables(variables)
221                                   .processInstanceVariableEquals("VNFQ_messageId", messageId).correlate();
222
223                         msoLogger.debug(logMarker + "***** Completed processing of MSO VnfAdapterNotifyService ******");
224                 } catch(MismatchingMessageCorrelationException e) {
225                         msoLogger.debug(logMarker + "[CORM]correlation id mismatch");
226                         String msg =
227                                 "VNF Adapter Notify Service received a Query VNF Notification request with RequestId '"
228                                 + messageId
229                                 + "' but that RequestId could not be correlated to any active process - ignoring the request";
230                         
231                         msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), 
232                                         MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
233                 }
234
235                 msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
236                                 logMarker + "Completed the execution of MSO Vnf Adapter Notify for Query VNF Notification.");
237                 
238                 return;
239          }
240
241
242
243
244     /**
245      *
246      * @param errorMessage
247      * @param exception
248      * @param rollback
249      * @param outputs
250      * @param messageId
251      * @param vnfId
252      * @param completed
253      */
254         @WebMethod(operationName = "createVnfNotification")
255     @Oneway
256     @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification")
257     @Action(input = "http://com.att.mso/notify/adapterNotify/createVnfNotificationRequest")
258         public void createVnfNotification(
259                         @WebParam(name = "messageId", targetNamespace = "")
260                 String messageId,
261                 @WebParam(name = "completed", targetNamespace = "")
262                 boolean completed,
263                 @WebParam(name = "exception", targetNamespace = "")
264                 MsoExceptionCategory exception,
265                 @WebParam(name = "errorMessage", targetNamespace = "")
266                 String errorMessage,
267                 @WebParam(name = "vnfId", targetNamespace = "")
268                 String vnfId,
269                 @WebParam(name = "outputs", targetNamespace = "")
270                 com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.CreateVnfNotification.Outputs outputs,
271                 @WebParam(name = "rollback", targetNamespace = "")
272                 VnfRollback rollback){
273
274                 CreateVnfNotification createVnfNotification = new CreateVnfNotification();
275
276                 createVnfNotification.setMessageId(messageId);
277                 createVnfNotification.setCompleted(completed);
278                 createVnfNotification.setException(exception);
279                 createVnfNotification.setErrorMessage(errorMessage);
280                 createVnfNotification.setVnfId(vnfId);
281                 createVnfNotification.setOutputs(outputs);
282                 createVnfNotification.setRollback(rollback);
283
284                 ProcessEngineServices pes = getProcessEngineServices();
285                 RuntimeService runtimeService = pes.getRuntimeService();
286
287                 msoLogger.setServiceName("MSO." + "vnf Adapter Create");
288                 msoLogger.setLogContext(messageId, "N/A");
289                 msoLogger.debug(logMarker + "Received CreateVnfNotification - " + createVnfNotification.toString());
290
291                 long startTime = System.currentTimeMillis();
292                 try {
293
294                         /* Check to make sure the process instance is ready for correlation*/
295                         isReadyforCorrelation(runtimeService, messageId, "createVnfNotificationCallback", "VNFC_messageId");
296
297                         msoLogger.debug(logMarker + "*** Received MSO createVnfNotification Callback ******");
298                         msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService ");
299                         
300                         msoLogger.debug(logMarker + "Create VNF Notification string:\n"  + createVnfNotification.toString());
301
302                         Map<String,Object> variables = new HashMap<String,Object>();
303                         variables.put("VNFC_messageId", messageId );
304                         variables.put("createVnfNotificationCallback", createVnfNotification.toString());
305
306                         /*Correlating the response with the running instance*/
307
308                         runtimeService.createMessageCorrelation("createVnfNotificationCallback").setVariables(variables)
309                                   .processInstanceVariableEquals("VNFC_messageId", messageId).correlate();
310
311                         msoLogger.debug(logMarker + "***** Completed processing of MSO VnfAdapterNotifyService ******");
312                 } catch(MismatchingMessageCorrelationException e) {
313                         msoLogger.debug(logMarker + "[CORM]correlation id mismatch");
314                         String msg =
315                                 "VNF Adapter Notify Service received a Create VNF Notification request with RequestId '"
316                                 + messageId
317                                 + "' but that RequestId could not be correlated to any active process - ignoring the request";
318                         
319                         msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), 
320                                         MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
321                         
322                 }
323                 msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
324                                 logMarker + "Completed the execution of MSO Vnf Adapter Notify for Query VNF Notification.");
325                 
326                 msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
327                                 logMarker + "Completed the execution of MSO Vnf Adapter Notify for Query VNF Notification.", "BPMN", 
328                                 MsoLogger.getServiceName(), "createVnfNotification");
329                 
330                 return;
331          }
332
333     /**
334      *
335      * @param errorMessage
336      * @param exception
337      * @param rollback
338      * @param outputs
339      * @param messageId
340      * @param completed
341      */
342         @WebMethod(operationName = "updateVnfNotification")
343     @Oneway
344     @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification")
345     @Action(input = "http://com.att.mso/notify/adapterNotify/updateVnfNotificationRequest")
346     public void updateVnfNotification(
347         @WebParam(name = "messageId", targetNamespace = "")
348         String messageId,
349         @WebParam(name = "completed", targetNamespace = "")
350         boolean completed,
351         @WebParam(name = "exception", targetNamespace = "")
352         MsoExceptionCategory exception,
353         @WebParam(name = "errorMessage", targetNamespace = "")
354         String errorMessage,
355         @WebParam(name = "outputs", targetNamespace = "")
356         com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.UpdateVnfNotification.Outputs outputs,
357         @WebParam(name = "rollback", targetNamespace = "")
358         VnfRollback rollback){
359
360         UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
361
362         updateVnfNotification.setMessageId(messageId);
363         updateVnfNotification.setCompleted(completed);
364         updateVnfNotification.setException(exception);
365         updateVnfNotification.setErrorMessage(errorMessage);
366         updateVnfNotification.setOutputs(outputs);
367         updateVnfNotification.setRollback(rollback);
368
369                 ProcessEngineServices pes = getProcessEngineServices();
370                 RuntimeService runtimeService = pes.getRuntimeService();
371
372                 msoLogger.setServiceName("MSO." + "vnf Adapter Update");
373                 msoLogger.setLogContext(messageId, "N/A");
374                 msoLogger.debug(logMarker + "Received UpdateVnfNotification - " + updateVnfNotification.toString());
375
376                 long startTime = System.currentTimeMillis();
377                 try {
378
379                         // Check to make sure the process instance is ready for correlation
380                         isReadyforCorrelation(runtimeService, messageId, "updateVnfNotificationCallback", "VNFU_messageId");
381
382                         msoLogger.debug(logMarker + "*** Received MSO updateVnfNotification Callback ******");
383                         msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService ");
384                         
385                         msoLogger.debug(logMarker + "Update VNF Notification string:\n"  + updateVnfNotification.toString());
386
387                         Map<String,Object> variables = new HashMap<String,Object>();
388                         variables.put("VNFU_messageId", messageId );
389                         variables.put("updateVnfNotificationCallback", updateVnfNotification.toString());
390
391                         //Correlating the response with the running instance
392                         runtimeService.createMessageCorrelation("updateVnfNotificationCallback").setVariables(variables)
393                                   .processInstanceVariableEquals("VNFU_messageId", messageId).correlate();
394
395                         msoLogger.debug(logMarker + "***** Completed processing of MSO VnfAdapterNotifyService ******");
396                         
397                 } catch(MismatchingMessageCorrelationException e) {
398                         msoLogger.debug(logMarker + "[CORM]correlation id mismatch");
399                         String msg =
400                                 "VNF Adapter Notify Service received a Update VNF Notification request with RequestId '"
401                                 + messageId
402                                 + "' but that RequestId could not be correlated to any active process - ignoring the request";
403                         
404                         msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), 
405                                         MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
406                         
407                 }
408                 msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
409                                 logMarker + "Completed the execution of MSO Vnf Adapter Notify for Update VNF Notification.");
410                 
411                 msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
412                                 logMarker + "Completed the execution of MSO Vnf Adapter Notify for Update VNF Notification.", "BPMN", 
413                                 MsoLogger.getServiceName(), "updateVnfNotification");
414                 
415                 return;
416          }
417
418     /**
419      *
420      * @param errorMessage
421      * @param exception
422      * @param messageId
423      * @param completed
424      */
425
426     //@WebService(serviceName="VNFAdapterDeleteCallbackV1", targetNamespace="http://com.att.mso/vnfNotify")
427     @WebMethod(operationName = "deleteVnfNotification")
428     @Oneway
429     @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification")
430     @Action(input = "http://com.att.mso/notify/adapterNotify/deleteVnfNotificationRequest")
431     public void deleteVnfNotification(
432         @WebParam(name = "messageId", targetNamespace = "")
433         String messageId,
434         @WebParam(name = "completed", targetNamespace = "")
435         boolean completed,
436         @WebParam(name = "exception", targetNamespace = "")
437         MsoExceptionCategory exception,
438         @WebParam(name = "errorMessage", targetNamespace = "")
439         String errorMessage) {
440
441                 //Callback URL to use http://localhost:8080/mso/services/VNFAdapterDeleteCallbackV1
442
443         //DeleteVnfNotification Class
444         DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
445         deleteVnfNotification.setMessageId(messageId);
446         deleteVnfNotification.setCompleted(completed);
447         deleteVnfNotification.setException(exception);
448         deleteVnfNotification.setErrorMessage(errorMessage);
449
450                 ProcessEngineServices pes = getProcessEngineServices();
451                 RuntimeService runtimeService = pes.getRuntimeService();
452
453                 MsoLogger.setServiceName("MSO." + "vnfAdapterDelete");
454                 MsoLogger.setLogContext(messageId, "N/A");
455                 msoLogger.debug(logMarker + "Received DeleteVnfNotification callback: " + deleteVnfNotification.toString());
456
457                 long startTime = System.currentTimeMillis();
458                 try {
459
460                         /* Check to make sure the process instance is ready for correlation*/
461                         //isReadyforCorrelation(runtimeService, messageId, "deleteVnfACallback", "VNFDEL_uuid");
462
463                         msoLogger.debug(logMarker + " *** Received MSO deleteVnfACallback ******");                     
464                         msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO deleteVnfACallback ");           
465                         msoLogger.debug(logMarker + " Callback response string:\n"  + deleteVnfNotification.toString());
466
467                         Map<String,Object> variables = new HashMap<String,Object>();
468                         variables.put("VNFDEL_uuid", messageId);
469                         variables.put("deleteVnfACallback", deleteVnfNotification.toString());
470
471                         /*Correlating the response with the running instance*/
472
473                         runtimeService.createMessageCorrelation("deleteVnfACallback")
474                                   .setVariables(variables)
475                                   .processInstanceVariableEquals("VNFDEL_uuid", messageId).correlate();
476
477                         msoLogger.debug(logMarker + "***** Completed processing of MSO deleteVnfACallback ******");
478
479                 } catch(MismatchingMessageCorrelationException e) {
480
481                         msoLogger.debug(logMarker + " [CORM]correlation id mismatch");
482                         // Couldn't correlate requestId to any active flow
483                         //MsoLogger logger = MsoLogger.getMsoLogger("SDNCAdapterCallbackService");
484
485                         String msg =
486                                 "Vnf Adapter Callback Service received a Vnf Adapter Callback with messageId '"
487                                 + messageId
488                                 + "' but that messageId could not be correlated to any active process - ignoring the Request";
489                         
490                         msoLogger.error(MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), 
491                                         MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
492
493                 }
494                 msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
495                                 logMarker + "Completed the execution of MSO VNFAdapterDeleteCallbackV1.");
496                 
497                 msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
498                                 logMarker + "Completed the execution of MSO VNFAdapterDeleteCallbackV1.", "BPMN", 
499                                 MsoLogger.getServiceName(), "deleteVnfNotification");
500                 
501                 return;
502         }
503
504         private void isReadyforCorrelation(RuntimeService runtimeService, String requestId, String responseName, String correlationValue) {
505
506                 long waitingInstances = runtimeService.createExecutionQuery().messageEventSubscriptionName(responseName).processVariableValueEquals(correlationValue, requestId).count();
507                 int retries = 50;
508                 while (waitingInstances==0 && retries > 0) {
509                   try {
510                         Thread.sleep(100);
511                 } catch (InterruptedException e) {
512                         // TODO Auto-generated catch block
513             // should I add new exception Message to MessageEnum???
514                         msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker, e);
515                         
516                 } // you can still play with the numbers
517                   waitingInstances = runtimeService.createExecutionQuery() //
518                           .messageEventSubscriptionName(responseName)
519                           .processVariableValueEquals(correlationValue, requestId).count();
520                   retries--;
521                 }
522         }
523
524
525         private ProcessEngineServices getProcessEngineServices() {
526                 if (pes4junit == null) {
527                         return BpmPlatform.getDefaultProcessEngine();
528                 } else {
529                         return pes4junit;
530                 }
531         }
532
533         @WebMethod(exclude=true)
534         public void setProcessEngineServices4junit(ProcessEngineServices pes) {
535                 pes4junit = pes;
536         }
537 }