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