Merge "updated ARIA version"
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / groovy / org / openecomp / mso / bpmn / infrastructure / scripts / DeleteGenericMacroServiceNetworkVnf.groovy
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 package org.openecomp.mso.bpmn.infrastructure.scripts;
21
22 import groovy.xml.XmlUtil
23 import groovy.json.*
24
25 import org.openecomp.mso.bpmn.core.json.JsonUtils
26 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
27 import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils
28 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
29 import org.openecomp.mso.bpmn.common.scripts.NetworkUtils
30 import org.openecomp.mso.bpmn.common.scripts.VidUtils
31 import org.openecomp.mso.bpmn.core.WorkflowException
32 import org.openecomp.mso.rest.APIResponse;
33
34
35 import java.util.UUID;
36
37 import org.camunda.bpm.engine.delegate.BpmnError
38 import org.camunda.bpm.engine.runtime.Execution
39 import org.json.JSONObject;
40 import org.json.JSONArray;
41 import org.apache.commons.lang3.*
42 import org.apache.commons.codec.binary.Base64;
43 import org.springframework.web.util.UriUtils;
44
45 /**
46  * This groovy class supports the <class>DeleteViprAtmService.bpmn</class> process.
47  *
48  */
49 public class DeleteGenericMacroServiceNetworkVnf extends AbstractServiceTaskProcessor {
50
51         String Prefix="DELVAS_"
52         ExceptionUtil exceptionUtil = new ExceptionUtil()
53         JsonUtils jsonUtil = new JsonUtils()
54         VidUtils vidUtils = new VidUtils()
55         CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
56         NetworkUtils networkUtils = new NetworkUtils()
57
58         /**
59          * This method is executed during the preProcessRequest task of the <class>DeleteGenericMacroServiceNetworkVnf.bpmn</class> process.
60          * @param execution
61          */
62         public InitializeProcessVariables(Execution execution){
63                 /* Initialize all the process variables in this block */
64
65                 execution.setVariable("DeleteGenericMacroServiceNetworkVnfRequest", "")
66                 execution.setVariable("msoRequestId", "")
67                 execution.setVariable("DELVAS_vnfsDeletedCount", 0)
68                 execution.setVariable("DELVAS_vnfsCount", 0)
69                 execution.setVariable("DELVAS_networksCount", 0)
70                 execution.setVariable("DELVAS_networksDeletedCount", 0)
71         }
72
73         // **************************************************
74         //     Pre or Prepare Request Section
75         // **************************************************
76         /**
77          * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
78          * @param execution
79          */
80         public void preProcessRequest (Execution execution) {
81                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
82                 execution.setVariable("prefix",Prefix)
83
84                 utils.log("DEBUG", " ***** Inside preProcessRequest DeleteGenericMacroServiceNetworkVnf Request ***** ", isDebugEnabled)
85
86                 try {
87                         // initialize flow variables
88                         InitializeProcessVariables(execution)
89
90                         // check for incoming json message/input
91                         String DeleteGenericMacroServiceNetworkVnfRequest = execution.getVariable("bpmnRequest")
92                         utils.logAudit(DeleteGenericMacroServiceNetworkVnfRequest)
93                         execution.setVariable("DeleteGenericMacroServiceNetworkVnfRequest", DeleteGenericMacroServiceNetworkVnfRequest);
94                         println 'DeleteGenericMacroServiceNetworkVnfRequest - ' + DeleteGenericMacroServiceNetworkVnfRequest
95
96                         // extract requestId
97                         String requestId = execution.getVariable("mso-request-id")
98                         execution.setVariable("msoRequestId", requestId)
99
100                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
101                         if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) {
102                                 String dataErrorMessage = " Element 'serviceInstanceId' is missing. "
103                                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
104                         }
105                         
106                         String requestAction = execution.getVariable("requestAction")
107                         execution.setVariable("requestAction", requestAction)
108
109                         String source = jsonUtil.getJsonValue(DeleteGenericMacroServiceNetworkVnfRequest, "requestDetails.requestInfo.source")
110                         if ((source == null) || (source.isEmpty())) {
111                                 execution.setVariable("source", "VID")
112                         } else {
113                                 execution.setVariable("source", source)
114                         }
115
116                         // extract globalSubscriberId
117                         String globalSubscriberId = jsonUtil.getJsonValue(DeleteGenericMacroServiceNetworkVnfRequest, "requestDetails.subscriberInfo.globalSubscriberId")
118
119                         // global-customer-id is optional on Delete
120
121                         execution.setVariable("globalSubscriberId", globalSubscriberId)
122                         execution.setVariable("globalCustomerId", globalSubscriberId)
123                         
124                         String suppressRollback = jsonUtil.getJsonValue(DeleteGenericMacroServiceNetworkVnfRequest, "requestDetails.requestInfo.suppressRollback")
125                         execution.setVariable("disableRollback", suppressRollback)
126                         utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled)
127                         
128                         String productFamilyId = jsonUtil.getJsonValue(DeleteGenericMacroServiceNetworkVnfRequest, "requestDetails.requestInfo.productFamilyId")
129                         execution.setVariable("productFamilyId", productFamilyId)
130                         utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled)
131                         
132                         // extract subscriptionServiceType
133                         String subscriptionServiceType = jsonUtil.getJsonValue(DeleteGenericMacroServiceNetworkVnfRequest, "requestDetails.requestParameters.subscriptionServiceType")
134                         execution.setVariable("subscriptionServiceType", subscriptionServiceType)
135                         utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled)
136                         
137                         // extract cloud configuration
138                         String lcpCloudRegionId = jsonUtil.getJsonValue(DeleteGenericMacroServiceNetworkVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
139                         execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)
140                         utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled)
141                         String tenantId = jsonUtil.getJsonValue(DeleteGenericMacroServiceNetworkVnfRequest, "requestDetails.cloudConfiguration.tenantId")
142                         execution.setVariable("tenantId", tenantId)
143                         utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)
144
145                         String sdncVersion = "1707"
146                         execution.setVariable("sdncVersion", sdncVersion)
147                         utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled)
148                         
149                         //For Completion Handler & Fallout Handler
150                         String requestInfo =
151                         """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
152                                         <request-id>${requestId}</request-id>
153                                         <action>DELETE</action>
154                                         <source>${source}</source>
155                                    </request-info>"""
156
157                         execution.setVariable("DELVAS_requestInfo", requestInfo)
158                         
159                         //Setting for Generic Sub Flows
160                         execution.setVariable("GENGS_type", "service-instance")
161                         
162                         utils.log("DEBUG", " ***** Completed preProcessRequest DeleteGenericMacroServiceNetworkVnf Request ***** ", isDebugEnabled)
163
164                 } catch (BpmnError e) {
165                         throw e;
166                 } catch (Exception ex){
167                         String exceptionMessage = "Bpmn error encountered in DeleteGenericMacroServiceNetworkVnf flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
168                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
169                 }
170         }
171
172         public void sendSyncResponse (Execution execution) {
173                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
174
175                 utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
176
177                 try {
178                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
179                         String requestId = execution.getVariable("mso-request-id")
180
181                         // RESTResponse (for API Handler (APIH) Reply Task)
182                         String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
183
184                         utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)
185                         sendWorkflowResponse(execution, 202, syncResponse)
186                 } catch (Exception ex) {
187                         String exceptionMessage = "Bpmn error encountered in DeleteGenericMacroServiceNetworkVnf flow. Unexpected from method sendSyncResponse() - " + ex.getMessage()
188                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
189                 }
190         }
191
192         public void prepareServiceInstanceDelete (Execution execution) {
193                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
194                 utils.log("DEBUG", " ***** Inside prepareServiceInstanceDelete() of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
195                 
196                 try {
197                         
198                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
199                         
200                         // confirm if ServiceInstance was found
201                         if ( !execution.getVariable("GENGS_FoundIndicator") )
202                         {
203                                 String exceptionMessage = "Bpmn error encountered in DeleteGenericMacroServiceNetworkVnf flow. Service Instance was not found in AAI by id: " + serviceInstanceId
204                                 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
205                         }
206                         
207                         // get variable within incoming json
208                         String DeleteGenericMacroServiceNetworkVnfRequest = execution.getVariable("DeleteGenericMacroServiceNetworkVnfRequest");
209                         
210                         // get SI extracted by GenericGetService
211                         String serviceInstanceAaiRecord = execution.getVariable("GENGS_service");
212                         
213                         utils.log("DEBUG", "serviceInstanceAaiRecord: "+serviceInstanceAaiRecord, isDebugEnabled)
214                         
215                         String relationship = ""
216                         try {
217                                 relationship = networkUtils.getFirstNodeXml(serviceInstanceAaiRecord, "relationship-list")
218                         } catch (Exception ex) {
219                                 //no relationships found
220                         }
221                         utils.log("DEBUG", " relationship string - " + relationship, isDebugEnabled)
222                         
223                         int vnfsCount = 0
224                         int networksCount = 0
225                         
226                         if (relationship != null && relationship.length() > 0){
227                                 relationship = relationship.trim().replace("tag0:","").replace(":tag0","")
228                                 
229                                 // Check if Network TableREf is present, then build a List of network policy
230                                 List relatedVnfIdList = networkUtils.getRelatedVnfIdList(relationship)
231                                 vnfsCount = relatedVnfIdList.size()
232                                 execution.setVariable("DELVAS_vnfsCount", vnfsCount)
233                                 utils.log("DEBUG", " DELVAS_vnfsCount : " + vnfsCount, isDebugEnabled)
234                                 execution.setVariable("DELVAS_relatedVnfIdList", relatedVnfIdList)
235                                 
236                                 // Check if Network TableREf is present, then build a List of network policy
237                                 List relatedNetworkIdList = networkUtils.getRelatedNetworkIdList(relationship)
238                                 networksCount = relatedNetworkIdList.size()
239                                 execution.setVariable("DELVAS_networksCount", networksCount)
240                                 utils.log("DEBUG", " DELVAS_networksCount : " + networksCount, isDebugEnabled)
241                                 execution.setVariable("DELVAS_relatedNetworkIdList", relatedNetworkIdList)
242                         } else {
243                                 execution.setVariable("DELVAS_vnfsCount", 0)
244                                 utils.log("DEBUG", " DELVAS_vnfsCount : " + vnfsCount, isDebugEnabled)
245                                 execution.setVariable("DELVAS_networksCount", 0)
246                                 utils.log("DEBUG", " DELVAS_networksCount : " + networksCount, isDebugEnabled)
247                         }
248                         
249                         utils.log("DEBUG", " ***** Completed prepareServiceInstanceDelete() of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
250                 } catch (Exception ex) {
251                         sendSyncError(execution)
252                    String exceptionMessage = "Bpmn error encountered in DeleteGenericMacroServiceNetworkVnf flow. prepareServiceInstanceDelete() - " + ex.getMessage()
253                    utils.log("DEBUG", exceptionMessage, isDebugEnabled)
254                    exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
255                 }
256         }
257         
258         
259         // *******************************
260         //     
261         // *******************************
262         public void prepareVnfAndModulesDelete (Execution execution) {
263                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
264
265                 try {
266                         utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteServiceInstanceMacro ***** ", isDebugEnabled)
267
268                         List vnfList = execution.getVariable("DELVAS_relatedVnfIdList")
269                         Integer vnfsDeletedCount = execution.getVariable("DELVAS_vnfsDeletedCount")
270                         String vnfModelInfoString = ""
271                         String vnfId = ""
272                         if (vnfList.size() > 0 ) {
273                                 vnfId = vnfList.get(vnfsDeletedCount.intValue())
274                         }
275                                                         
276                         execution.setVariable("vnfId", vnfId)
277                         utils.log("DEBUG", "need to delete vnfId:" + vnfId, isDebugEnabled)
278
279                         utils.log("DEBUG", " ***** Completed prepareVnfAndModulesDelete of DeleteServiceInstanceMacro ***** ", isDebugEnabled)
280                 } catch (Exception ex) {
281                         // try error in method block
282                         String exceptionMessage = "Bpmn error encountered in DeleteServiceInstanceMacro flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage()
283                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
284                 }
285          }
286         
287         // *******************************
288         //     Validate Vnf request Section -> increment count
289         // *******************************
290         public void validateVnfDelete (Execution execution) {
291                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
292
293                 try {
294                         utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
295
296                         String vnfsDeletedCount = execution.getVariable("DELVAS_vnfsDeletedCount")
297                         vnfsDeletedCount++
298                         
299                         execution.setVariable("DELVAS_vnfsDeletedCount", vnfsDeletedCount)
300                         
301                         utils.log("DEBUG", " ***** Completed validateVnfDelete of DeleteGenericMacroServiceNetworkVnf ***** "+" vnf # "+vnfsDeletedCount, isDebugEnabled)
302                 } catch (Exception ex) {
303                         // try error in method block
304                         String exceptionMessage = "Bpmn error encountered in DeleteGenericMacroServiceNetworkVnf flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage()
305                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
306                 }
307          }
308         
309         // *******************************
310         //     Generate Network request Section
311         // *******************************
312         public void prepareNetworkDelete (Execution execution) {
313                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
314
315                 try {
316                         utils.log("DEBUG", " ***** Inside prepareNetworkDelete of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
317
318                         List networkList = execution.getVariable("DELVAS_relatedNetworkIdList")
319                         Integer networksDeletedCount = execution.getVariable("DELVAS_networksDeletedCount")
320
321                         String networkId = ""
322                         if (networkList.size() > 0) {
323                                 networkId = networkList.get(networksDeletedCount.intValue())
324                         }
325                                                         
326                         execution.setVariable("networkId", networkId)
327                         utils.log("DEBUG", "need to delete networkId:" + networkId, isDebugEnabled)
328                         
329                         utils.log("DEBUG", " ***** Completed prepareNetworkDelete of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
330                 } catch (Exception ex) {
331                         // try error in method block
332                         String exceptionMessage = q"Bpmn error encountered in DeleteGenericMacroServiceNetworkVnf flow. Unexpected Error from method prepareNetworkDelete() - " + ex.getMessage()
333                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
334                 }
335          }
336         
337         // *******************************
338         //     Validate Network request Section
339         // *******************************
340         public void validateNetworkDelete (Execution execution) {
341                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
342
343                 try {
344                         utils.log("DEBUG", " ***** Inside validateNetworkDelete of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
345
346                         Integer networksDeletedCount = execution.getVariable("DELVAS_networksDeletedCount")
347                         networksDeletedCount++
348                         
349                         execution.setVariable("DELVAS_networksDeletedCount", networksDeletedCount)
350                         
351                         utils.log("DEBUG", " ***** Completed validateNetworkDelete of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
352                 } catch (Exception ex) {
353                         // try error in method block
354                         String exceptionMessage = "Bpmn error encountered in DeleteGenericMacroServiceNetworkVnf flow. Unexpected Error from method validateNetworkDelete() - " + ex.getMessage()
355                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
356                 }
357          }
358
359         
360         // *****************************************
361         //     Prepare Completion request Section
362         // *****************************************
363         public void postProcessResponse (Execution execution) {
364                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
365                 utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteGenericMacroServiceNetworkVnf ***** ", isDebugEnabled)
366
367                 try {
368                         String source = execution.getVariable("source")
369                         String requestId = execution.getVariable("msoRequestId")
370
371                         String msoCompletionRequest =
372                                         """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
373                                                                         xmlns:ns="http://org.openecomp/mso/request/types/v1">
374                                                         <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
375                                                                 <request-id>${requestId}</request-id>
376                                                                 <action>DELETE</action>
377                                                                 <source>${source}</source>
378                                                            </request-info>
379                                                         <aetgt:status-message>vIPR ATM Service Instance has been deleted successfully.</aetgt:status-message>
380                                                            <aetgt:mso-bpel-name>BPMN Service Instance macro action: DELETE</aetgt:mso-bpel-name>
381                                                 </aetgt:MsoCompletionRequest>"""
382
383                         // Format Response
384                         String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
385
386                         utils.logAudit(xmlMsoCompletionRequest)
387                         execution.setVariable("DELVAS_Success", true)
388                         execution.setVariable("DELVAS_CompleteMsoProcessRequest", xmlMsoCompletionRequest)
389                         utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
390                 } catch (BpmnError e) {
391                 throw e;
392
393                 } catch (Exception ex) {
394                         // try error in method block
395                         String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage()
396                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
397                 }
398         }
399
400         public void prepareFalloutRequest(Execution execution){
401                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
402                 utils.log("DEBUG", " *** STARTED DeleteGenericMacroServiceNetworkVnf prepareFalloutRequest Process *** ", isDebugEnabled)
403
404                 try {
405                         WorkflowException wfex = execution.getVariable("WorkflowException")
406                         utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)
407                         String requestInfo = execution.getVariable("DELVAS_requestInfo")
408                         utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)
409
410                         String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
411
412                         execution.setVariable("DELVAS_falloutRequest", falloutRequest)
413                 } catch (Exception ex) {
414                         utils.log("DEBUG", "Error Occured in DeleteGenericMacroServiceNetworkVnf prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)
415                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteGenericMacroServiceNetworkVnf prepareFalloutRequest Process")
416                 }
417                 utils.log("DEBUG", "*** COMPLETED DeleteGenericMacroServiceNetworkVnf prepareFalloutRequest Process ***", isDebugEnabled)
418         }
419
420
421         public void sendSyncError (Execution execution) {
422                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
423                 utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteServiceInstanceInfra ***** ", isDebugEnabled)
424
425                 try {
426                         String errorMessage = ""
427                         if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
428                                 WorkflowException wfe = execution.getVariable("WorkflowException")
429                                 errorMessage = wfe.getErrorMessage()
430                         } else {
431                                 errorMessage = "Sending Sync Error."
432                         }
433
434                         String buildworkflowException =
435                                 """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
436                                         <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
437                                         <aetgt:ErrorCode>7000</aetgt:ErrorCode>
438                                    </aetgt:WorkflowException>"""
439
440                         utils.logAudit(buildworkflowException)
441                         sendWorkflowResponse(execution, 500, buildworkflowException)
442                 } catch (Exception ex) {
443                         utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
444                 }
445         }
446
447         public void processJavaException(Execution execution){
448                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
449                 execution.setVariable("prefix",Prefix)
450                 try{
451                         utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)
452                         utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)
453                         utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)
454                         execution.setVariable("DELVAS_unexpectedError", "Caught a Java Lang Exception")  // Adding this line temporarily until this flows error handling gets updated
455                         exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
456                 }catch(BpmnError b){
457                         utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)
458                         throw b
459                 }catch(Exception e){
460                         utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)
461                         execution.setVariable("DELVAS_unexpectedError", "Exception in processJavaException method")  // Adding this line temporarily until this flows error handling gets updated
462                         exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")
463                 }
464                 utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)
465         }
466
467
468 }