04eb4c7d7e1ae26e4d7f04ac54580af6dff75b4e
[so.git] /
1 /*\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP - SO\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 package org.openecomp.mso.bpmn.vcpe.scripts\r
21 \r
22 import groovy.xml.XmlUtil\r
23 import groovy.json.*\r
24 \r
25 import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils;\r
26 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil\r
27 import org.openecomp.mso.bpmn.common.scripts.NetworkUtils;\r
28 import org.openecomp.mso.bpmn.common.scripts.VidUtils;\r
29 import org.openecomp.mso.bpmn.core.json.JsonUtils\r
30 import org.openecomp.mso.bpmn.core.WorkflowException\r
31 import org.openecomp.mso.rest.APIResponse\r
32 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor\r
33 \r
34 import java.util.UUID;\r
35 \r
36 import org.camunda.bpm.engine.delegate.BpmnError\r
37 import org.camunda.bpm.engine.runtime.Execution\r
38 import org.json.JSONObject;\r
39 import org.json.JSONArray;\r
40 import org.apache.commons.lang3.*\r
41 import org.apache.commons.codec.binary.Base64;\r
42 import org.springframework.web.util.UriUtils;\r
43 \r
44 /**\r
45  * This groovy class supports the <class>DeleteVcpeResCustService.bpmn</class> process.\r
46  *\r
47  * @author dm4252\r
48  *\r
49  */\r
50 public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {\r
51 \r
52         private static final String DebugFlag = "isDebugLogEnabled"\r
53 \r
54         String Prefix = "DVRCS_"\r
55         ExceptionUtil exceptionUtil = new ExceptionUtil()\r
56         JsonUtils jsonUtil = new JsonUtils()\r
57         VidUtils vidUtils = new VidUtils()\r
58         CatalogDbUtils catalogDbUtils = new CatalogDbUtils()\r
59         NetworkUtils networkUtils = new NetworkUtils()\r
60 \r
61         /**\r
62          * This method is executed during the preProcessRequest task of the <class>DeleteVcpeResCustService.bpmn</class> process.\r
63          * @param execution\r
64          */\r
65         public InitializeProcessVariables(Execution execution){\r
66                 /* Initialize all the process variables in this block */\r
67 \r
68                 execution.setVariable("DeleteVcpeResCustServiceRequest", "")\r
69                 execution.setVariable("msoRequestId", "")\r
70                 execution.setVariable(Prefix+"vnfsDeletedCount", 0)\r
71                 execution.setVariable(Prefix+"vnfsCount", 0)\r
72         }\r
73 \r
74         // **************************************************\r
75         //     Pre or Prepare Request Section\r
76         // **************************************************\r
77         /**\r
78          * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.\r
79          * @param execution\r
80          */\r
81         public void preProcessRequest (Execution execution) {\r
82                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
83                 execution.setVariable("prefix",Prefix)\r
84 \r
85                 utils.log("DEBUG", " ***** Inside preProcessRequest DeleteVcpeResCustService Request ***** ", isDebugEnabled)\r
86 \r
87                 try {\r
88                         // initialize flow variables\r
89                         InitializeProcessVariables(execution)\r
90 \r
91                         // check for incoming json message/input\r
92                         String DeleteVcpeResCustServiceRequest = execution.getVariable("bpmnRequest")\r
93                         utils.logAudit(DeleteVcpeResCustServiceRequest)\r
94                         execution.setVariable("DeleteVcpeResCustServiceRequest", DeleteVcpeResCustServiceRequest);\r
95                         println 'DeleteVcpeResCustServiceRequest - ' + DeleteVcpeResCustServiceRequest\r
96 \r
97                         // extract requestId\r
98                         String requestId = execution.getVariable("mso-request-id")\r
99                         execution.setVariable("msoRequestId", requestId)\r
100 \r
101                         String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
102                         if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) {\r
103                                 String dataErrorMessage = " Element 'serviceInstanceId' is missing. "\r
104                                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)\r
105                         }\r
106                         \r
107                         String requestAction = execution.getVariable("requestAction")\r
108                         execution.setVariable("requestAction", requestAction)\r
109 \r
110                         String source = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.source")\r
111                         if ((source == null) || (source.isEmpty())) {\r
112                                 source = "VID"\r
113                         }\r
114                         execution.setVariable("source", source)\r
115 \r
116                         // extract globalSubscriberId\r
117                         String globalSubscriberId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId")\r
118 \r
119                         // global-customer-id is optional on Delete\r
120 \r
121                         execution.setVariable("globalSubscriberId", globalSubscriberId)\r
122                         execution.setVariable("globalCustomerId", globalSubscriberId)\r
123                         \r
124                         String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback")\r
125                         execution.setVariable("disableRollback", suppressRollback)\r
126                         utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled)\r
127                         \r
128                         String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId")\r
129                         execution.setVariable("productFamilyId", productFamilyId)\r
130                         utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled)\r
131                         \r
132                         // extract subscriptionServiceType\r
133                         String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType")\r
134                         execution.setVariable("subscriptionServiceType", subscriptionServiceType)\r
135                         utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled)\r
136                         \r
137                         // extract cloud configuration\r
138                         String lcpCloudRegionId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")\r
139                         execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)\r
140                         utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled)\r
141                         String tenantId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration.tenantId")\r
142                         execution.setVariable("tenantId", tenantId)\r
143                         utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)\r
144 \r
145                         String sdncVersion = "1702"\r
146                         execution.setVariable("sdncVersion", sdncVersion)\r
147                         utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled)\r
148                         \r
149                         //For Completion Handler & Fallout Handler\r
150                         String requestInfo =\r
151                         """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">\r
152                                         <request-id>${requestId}</request-id>\r
153                                         <action>DELETE</action>\r
154                                         <source>${source}</source>\r
155                                    </request-info>"""\r
156 \r
157                         execution.setVariable(Prefix+"requestInfo", requestInfo)\r
158                         \r
159                         //Setting for Generic Sub Flows\r
160                         execution.setVariable("GENGS_type", "service-instance")\r
161                         \r
162                         utils.log("DEBUG", " ***** Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ***** ", isDebugEnabled)\r
163 \r
164                 } catch (BpmnError e) {\r
165                         throw e;\r
166                 } catch (Exception ex){\r
167                         String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()\r
168                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
169                 }\r
170         }\r
171 \r
172         public void sendSyncResponse(Execution execution) {\r
173                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
174 \r
175                 utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
176 \r
177                 try {\r
178                         String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
179                         String requestId = execution.getVariable("mso-request-id")\r
180 \r
181                         // RESTResponse (for API Handler (APIH) Reply Task)\r
182                         String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()\r
183 \r
184                         utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)\r
185                         sendWorkflowResponse(execution, 202, syncResponse)\r
186                 } catch (Exception ex) {\r
187                         String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
188                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
189                 }\r
190         }\r
191 \r
192         public void prepareServiceDelete(Execution execution) {\r
193                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
194                 utils.log("DEBUG", " ***** Inside prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
195                 \r
196                 try {\r
197                         \r
198                         String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
199                         \r
200                         // confirm if ServiceInstance was found\r
201                         if ( !execution.getVariable("GENGS_FoundIndicator") )\r
202                         {\r
203                                 String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId\r
204                                 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
205                         }\r
206                         \r
207                         // get variable within incoming json\r
208                         String DeleteVcpeResCustServiceRequest = execution.getVariable("DeleteVcpeResCustServiceRequest");\r
209                         \r
210                         // get SI extracted by GenericGetService\r
211                         String serviceInstanceAaiRecord = execution.getVariable("GENGS_service");\r
212                         \r
213                         utils.log("DEBUG", "serviceInstanceAaiRecord: "+serviceInstanceAaiRecord, isDebugEnabled)\r
214                         \r
215                         // determine if AR needs to be deleted\r
216                         boolean DVRCS_TunnelXConn = false\r
217                         boolean DVRCS_BRG = false\r
218                         String TXC_allottedResourceId\r
219                         String BRG_allottedResourceId\r
220                         XmlParser xmlParser = new XmlParser()\r
221                         def groovy.util.Node siNode = xmlParser.parseText(serviceInstanceAaiRecord)\r
222                         def groovy.util.Node arList = utils.getChildNode(siNode, 'allotted-resources')\r
223                         if (arList != null) {\r
224                                 def groovy.util.NodeList ars = utils.getIdenticalChildren(arList, 'allotted-resource')\r
225                                 for (groovy.util.Node ar in ars) {\r
226                                         def type = utils.getChildNodeText(ar, 'type')\r
227                                         if ("TunnelXConn".equals(type)) {\r
228                                                 utils.log("DEBUG","TunnelXConn AR found", isDebugEnabled)\r
229                                                 def id = utils.getChildNodeText(ar, 'id')\r
230                                                 if (id != null){\r
231                                                         DVRCS_TunnelXConn = true\r
232                                                         TXC_allottedResourceId = id\r
233                                                 }\r
234                                         } else if ("BRG".equals(type)) {\r
235                                                 utils.log("DEBUG","FW AR found", isDebugEnabled)\r
236                                                 def id = utils.getChildNodeText(ar, 'id')\r
237                                                 if (id != null){\r
238                                                         DVRCS_BRG = true\r
239                                                         BRG_allottedResourceId = id\r
240                                                 }\r
241                                         }\r
242                                 }\r
243                         }\r
244                         execution.setVariable(Prefix+"TunnelXConn", DVRCS_TunnelXConn)\r
245                         utils.log("DEBUG", Prefix+"TunnelXConn : " + DVRCS_TunnelXConn, isDebugEnabled)\r
246                         execution.setVariable("TXC_allottedResourceId", TXC_allottedResourceId)\r
247                         utils.log("DEBUG", "TXC_allottedResourceId : " + TXC_allottedResourceId, isDebugEnabled)\r
248                         \r
249                         execution.setVariable(Prefix+"BRG", DVRCS_BRG)\r
250                         utils.log("DEBUG", Prefix+"BRG : " + DVRCS_BRG, isDebugEnabled)\r
251                         execution.setVariable("BRG_allottedResourceId", BRG_allottedResourceId)\r
252                         utils.log("DEBUG", "BRG_allottedResourceId : " + BRG_allottedResourceId, isDebugEnabled)\r
253                 \r
254                         String relationship = ""\r
255                         try {\r
256                                 relationship = networkUtils.getFirstNodeXml(serviceInstanceAaiRecord, "relationship-list")\r
257                         } catch (Exception ex) {\r
258                                 //no relationships found\r
259                         }\r
260                         utils.log("DEBUG", " relationship string - " + relationship, isDebugEnabled)\r
261                         \r
262                         int vnfsCount = 0\r
263                         \r
264                         if (relationship != null && relationship.length() > 0){\r
265                                 relationship = relationship.trim().replace("tag0:","").replace(":tag0","")\r
266                                 \r
267                                 // Check if Network TableREf is present, then build a List of network policy\r
268                                 List relatedVnfIdList = networkUtils.getRelatedVnfIdList(relationship)\r
269                                 vnfsCount = relatedVnfIdList.size()\r
270                                 execution.setVariable(Prefix+"vnfsCount", vnfsCount)\r
271                                 utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)\r
272                                 execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList)\r
273                         } else {\r
274                                 execution.setVariable(Prefix+"vnfsCount", 0)\r
275                                 utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)\r
276                         }\r
277                         \r
278                         utils.log("DEBUG", " ***** Completed prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
279                 } catch (BpmnError e){\r
280                         throw e;\r
281                 } catch (Exception ex) {\r
282                         sendSyncError(execution)\r
283                    String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceInstanceDelete() - " + ex.getMessage()\r
284                    utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
285                    exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
286                 }\r
287         }\r
288         \r
289         \r
290         // *******************************\r
291         //     \r
292         // *******************************\r
293         public void prepareVnfAndModulesDelete (Execution execution) {\r
294                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
295                 utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
296 \r
297                 try {\r
298                         List vnfList = execution.getVariable(Prefix+"relatedVnfIdList")\r
299                         int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount")\r
300                         String vnfModelInfoString = ""\r
301                         String vnfId = ""\r
302                         if (vnfList.size() > 0 ) {\r
303                                 vnfId = vnfList.get(vnfsDeletedCount.intValue())\r
304                         }\r
305                                                         \r
306                         execution.setVariable("vnfId", vnfId)\r
307                         utils.log("DEBUG", "need to delete vnfId:" + vnfId, isDebugEnabled)\r
308 \r
309                         utils.log("DEBUG", " ***** Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
310                 } catch (Exception ex) {\r
311                         // try error in method block\r
312                         String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage()\r
313                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
314                 }\r
315          }\r
316         \r
317         // *******************************\r
318         //     Validate Vnf request Section -> increment count\r
319         // *******************************\r
320         public void validateVnfDelete (Execution execution) {\r
321                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
322                 utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
323 \r
324                 try {\r
325                         int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount")\r
326                         vnfsDeletedCount++\r
327                         \r
328                         execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount)\r
329                         \r
330                         utils.log("DEBUG", " ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount, isDebugEnabled)\r
331                 } catch (Exception ex) {\r
332                         // try error in method block\r
333                         String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage()\r
334                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
335                 }\r
336          }\r
337 \r
338         \r
339         // *****************************************\r
340         //     Prepare Completion request Section\r
341         // *****************************************\r
342         public void postProcessResponse (Execution execution) {\r
343                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
344                 utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
345 \r
346                 try {\r
347                         String source = execution.getVariable("source")\r
348                         String requestId = execution.getVariable("msoRequestId")\r
349 \r
350                         String msoCompletionRequest =\r
351                                         """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"\r
352                                                                         xmlns:ns="http://org.openecomp/mso/request/types/v1">\r
353                                                         <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">\r
354                                                                 <request-id>${requestId}</request-id>\r
355                                                                 <action>DELETE</action>\r
356                                                                 <source>${source}</source>\r
357                                                            </request-info>\r
358                                                         <aetgt:status-message>vCPE Res Cust Service Instance has been deleted successfully.</aetgt:status-message>\r
359                                                            <aetgt:mso-bpel-name>BPMN Service Instance macro action: DELETE</aetgt:mso-bpel-name>\r
360                                                 </aetgt:MsoCompletionRequest>"""\r
361 \r
362                         // Format Response\r
363                         String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)\r
364 \r
365                         utils.logAudit(xmlMsoCompletionRequest)\r
366                         execution.setVariable(Prefix+"Success", true)\r
367                         execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest)\r
368                         utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)\r
369                 } catch (BpmnError e) {\r
370                 throw e;\r
371 \r
372                 } catch (Exception ex) {\r
373                         // try error in method block\r
374                         String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage()\r
375                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
376                 }\r
377         }\r
378 \r
379         public void prepareFalloutRequest(Execution execution){\r
380                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
381                 utils.log("DEBUG", " *** STARTED DeleteVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled)\r
382 \r
383                 try {\r
384                         WorkflowException wfex = execution.getVariable("WorkflowException")\r
385                         utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)\r
386                         String requestInfo = execution.getVariable(Prefix+"requestInfo")\r
387                         utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)\r
388 \r
389                         String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)\r
390 \r
391                         execution.setVariable(Prefix+"falloutRequest", falloutRequest)\r
392                 } catch (Exception ex) {\r
393                         utils.log("DEBUG", "Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)\r
394                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeResCustService prepareFalloutRequest Process")\r
395                 }\r
396                 utils.log("DEBUG", "*** COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled)\r
397         }\r
398 \r
399 \r
400         public void sendSyncError (Execution execution) {\r
401                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
402                 utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
403 \r
404                 try {\r
405                         String errorMessage = ""\r
406                         if (execution.getVariable("WorkflowException") instanceof WorkflowException) {\r
407                                 WorkflowException wfe = execution.getVariable("WorkflowException")\r
408                                 errorMessage = wfe.getErrorMessage()\r
409                         } else {\r
410                                 errorMessage = "Sending Sync Error."\r
411                         }\r
412 \r
413                         String buildworkflowException =\r
414                                 """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">\r
415                                         <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>\r
416                                         <aetgt:ErrorCode>7000</aetgt:ErrorCode>\r
417                                    </aetgt:WorkflowException>"""\r
418 \r
419                         utils.logAudit(buildworkflowException)\r
420                         sendWorkflowResponse(execution, 500, buildworkflowException)\r
421                 } catch (Exception ex) {\r
422                         utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)\r
423                 }\r
424         }\r
425 \r
426         public void processJavaException(Execution execution){\r
427                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
428                 execution.setVariable("prefix",Prefix)\r
429                 try{\r
430                         utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)\r
431                         utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)\r
432                         utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)\r
433                         execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception")  // Adding this line temporarily until this flows error handling gets updated\r
434                         exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")\r
435                 }catch(BpmnError b){\r
436                         utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)\r
437                         throw b\r
438                 }catch(Exception e){\r
439                         utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)\r
440                         execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method")  // Adding this line temporarily until this flows error handling gets updated\r
441                         exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")\r
442                 }\r
443                 utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)\r
444         }\r
445 \r
446 \r
447 }\r