77ef3f6fe0b9d6e9a2d1a0f03e9f5c4a34d9786d
[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 cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration")\r
139                         execution.setVariable("cloudConfiguration", cloudConfiguration)\r
140                         utils.log("DEBUG","cloudConfiguration: "+ cloudConfiguration, isDebugEnabled)\r
141                         String lcpCloudRegionId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")\r
142                         execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)\r
143                         utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled)\r
144                         String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")\r
145                         execution.setVariable("tenantId", tenantId)\r
146                         utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)\r
147 \r
148                         String sdncVersion = "1702"\r
149                         execution.setVariable("sdncVersion", sdncVersion)\r
150                         utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled)\r
151                         \r
152                         //For Completion Handler & Fallout Handler\r
153                         String requestInfo =\r
154                         """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">\r
155                                         <request-id>${requestId}</request-id>\r
156                                         <action>DELETE</action>\r
157                                         <source>${source}</source>\r
158                                    </request-info>"""\r
159 \r
160                         execution.setVariable(Prefix+"requestInfo", requestInfo)\r
161                         \r
162                         //Setting for Generic Sub Flows\r
163                         execution.setVariable("GENGS_type", "service-instance")\r
164                         \r
165                         utils.log("DEBUG", " ***** Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ***** ", isDebugEnabled)\r
166 \r
167                 } catch (BpmnError e) {\r
168                         throw e;\r
169                 } catch (Exception ex){\r
170                         String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()\r
171                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
172                 }\r
173         }\r
174 \r
175         public void sendSyncResponse(Execution execution) {\r
176                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
177 \r
178                 utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
179 \r
180                 try {\r
181                         String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
182                         String requestId = execution.getVariable("mso-request-id")\r
183 \r
184                         // RESTResponse (for API Handler (APIH) Reply Task)\r
185                         String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()\r
186 \r
187                         utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)\r
188                         sendWorkflowResponse(execution, 202, syncResponse)\r
189                 } catch (Exception ex) {\r
190                         String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
191                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
192                 }\r
193         }\r
194 \r
195         public void prepareServiceDelete(Execution execution) {\r
196                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
197                 utils.log("DEBUG", " ***** Inside prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
198                 \r
199                 try {\r
200                         \r
201                         String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
202                         \r
203                         // confirm if ServiceInstance was found\r
204                         if ( !execution.getVariable("GENGS_FoundIndicator") )\r
205                         {\r
206                                 String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId\r
207                                 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
208                         }\r
209                         \r
210                         // get variable within incoming json\r
211                         String DeleteVcpeResCustServiceRequest = execution.getVariable("DeleteVcpeResCustServiceRequest");\r
212                         \r
213                         // get SI extracted by GenericGetService\r
214                         String serviceInstanceAaiRecord = execution.getVariable("GENGS_service");\r
215                         \r
216                         utils.log("DEBUG", "serviceInstanceAaiRecord: "+serviceInstanceAaiRecord, isDebugEnabled)\r
217                         \r
218                         // determine if AR needs to be deleted\r
219                         boolean DVRCS_TunnelXConn = false\r
220                         boolean DVRCS_BRG = false\r
221                         String TXC_allottedResourceId\r
222                         String BRG_allottedResourceId\r
223                         XmlParser xmlParser = new XmlParser()\r
224                         def groovy.util.Node siNode = xmlParser.parseText(serviceInstanceAaiRecord)\r
225                         def groovy.util.Node arList = utils.getChildNode(siNode, 'allotted-resources')\r
226                         if (arList != null) {\r
227                                 def groovy.util.NodeList ars = utils.getIdenticalChildren(arList, 'allotted-resource')\r
228                                 for (groovy.util.Node ar in ars) {\r
229                                         def type = utils.getChildNodeText(ar, 'type')\r
230                                         if ("TunnelXConn".equals(type)) {\r
231                                                 utils.log("DEBUG","TunnelXConn AR found", isDebugEnabled)\r
232                                                 def id = utils.getChildNodeText(ar, 'id')\r
233                                                 if (id != null){\r
234                                                         DVRCS_TunnelXConn = true\r
235                                                         TXC_allottedResourceId = id\r
236                                                 }\r
237                                         } else if ("BRG".equals(type)) {\r
238                                                 utils.log("DEBUG","FW AR found", isDebugEnabled)\r
239                                                 def id = utils.getChildNodeText(ar, 'id')\r
240                                                 if (id != null){\r
241                                                         DVRCS_BRG = true\r
242                                                         BRG_allottedResourceId = id\r
243                                                 }\r
244                                         }\r
245                                 }\r
246                         }\r
247                         execution.setVariable(Prefix+"TunnelXConn", DVRCS_TunnelXConn)\r
248                         utils.log("DEBUG", Prefix+"TunnelXConn : " + DVRCS_TunnelXConn, isDebugEnabled)\r
249                         execution.setVariable("TXC_allottedResourceId", TXC_allottedResourceId)\r
250                         utils.log("DEBUG", "TXC_allottedResourceId : " + TXC_allottedResourceId, isDebugEnabled)\r
251                         \r
252                         execution.setVariable(Prefix+"BRG", DVRCS_BRG)\r
253                         utils.log("DEBUG", Prefix+"BRG : " + DVRCS_BRG, isDebugEnabled)\r
254                         execution.setVariable("BRG_allottedResourceId", BRG_allottedResourceId)\r
255                         utils.log("DEBUG", "BRG_allottedResourceId : " + BRG_allottedResourceId, isDebugEnabled)\r
256                 \r
257                         String relationship = ""\r
258                         try {\r
259                                 relationship = networkUtils.getFirstNodeXml(serviceInstanceAaiRecord, "relationship-list")\r
260                         } catch (Exception ex) {\r
261                                 //no relationships found\r
262                         }\r
263                         utils.log("DEBUG", " relationship string - " + relationship, isDebugEnabled)\r
264                         \r
265                         int vnfsCount = 0\r
266                         \r
267                         if (relationship != null && relationship.length() > 0){\r
268                                 relationship = relationship.trim().replace("tag0:","").replace(":tag0","")\r
269                                 \r
270                                 // Check if Network TableREf is present, then build a List of network policy\r
271                                 List relatedVnfIdList = networkUtils.getRelatedVnfIdList(relationship)\r
272                                 vnfsCount = relatedVnfIdList.size()\r
273                                 execution.setVariable(Prefix+"vnfsCount", vnfsCount)\r
274                                 utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)\r
275                                 execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList)\r
276                         } else {\r
277                                 execution.setVariable(Prefix+"vnfsCount", 0)\r
278                                 utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)\r
279                         }\r
280                         \r
281                         utils.log("DEBUG", " ***** Completed prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
282                 } catch (BpmnError e){\r
283                         throw e;\r
284                 } catch (Exception ex) {\r
285                         sendSyncError(execution)\r
286                    String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceInstanceDelete() - " + ex.getMessage()\r
287                    utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
288                    exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
289                 }\r
290         }\r
291         \r
292         \r
293         // *******************************\r
294         //     \r
295         // *******************************\r
296         public void prepareVnfAndModulesDelete (Execution execution) {\r
297                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
298                 utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
299 \r
300                 try {\r
301                         List vnfList = execution.getVariable(Prefix+"relatedVnfIdList")\r
302                         int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount")\r
303                         String vnfModelInfoString = ""\r
304                         String vnfId = ""\r
305                         if (vnfList.size() > 0 ) {\r
306                                 vnfId = vnfList.get(vnfsDeletedCount.intValue())\r
307                         }\r
308                                                         \r
309                         execution.setVariable("vnfId", vnfId)\r
310                         utils.log("DEBUG", "need to delete vnfId:" + vnfId, isDebugEnabled)\r
311 \r
312                         utils.log("DEBUG", " ***** Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
313                 } catch (Exception ex) {\r
314                         // try error in method block\r
315                         String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage()\r
316                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
317                 }\r
318          }\r
319         \r
320         // *******************************\r
321         //     Validate Vnf request Section -> increment count\r
322         // *******************************\r
323         public void validateVnfDelete (Execution execution) {\r
324                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
325                 utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
326 \r
327                 try {\r
328                         int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount")\r
329                         vnfsDeletedCount++\r
330                         \r
331                         execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount)\r
332                         \r
333                         utils.log("DEBUG", " ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount, isDebugEnabled)\r
334                 } catch (Exception ex) {\r
335                         // try error in method block\r
336                         String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage()\r
337                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
338                 }\r
339          }\r
340 \r
341         \r
342         // *****************************************\r
343         //     Prepare Completion request Section\r
344         // *****************************************\r
345         public void postProcessResponse (Execution execution) {\r
346                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
347                 utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
348 \r
349                 try {\r
350                         String source = execution.getVariable("source")\r
351                         String requestId = execution.getVariable("msoRequestId")\r
352 \r
353                         String msoCompletionRequest =\r
354                                         """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"\r
355                                                                         xmlns:ns="http://org.openecomp/mso/request/types/v1">\r
356                                                         <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">\r
357                                                                 <request-id>${requestId}</request-id>\r
358                                                                 <action>DELETE</action>\r
359                                                                 <source>${source}</source>\r
360                                                            </request-info>\r
361                                                         <aetgt:status-message>vCPE Res Cust Service Instance has been deleted successfully.</aetgt:status-message>\r
362                                                            <aetgt:mso-bpel-name>BPMN Service Instance macro action: DELETE</aetgt:mso-bpel-name>\r
363                                                 </aetgt:MsoCompletionRequest>"""\r
364 \r
365                         // Format Response\r
366                         String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)\r
367 \r
368                         utils.logAudit(xmlMsoCompletionRequest)\r
369                         execution.setVariable(Prefix+"Success", true)\r
370                         execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest)\r
371                         utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)\r
372                 } catch (BpmnError e) {\r
373                 throw e;\r
374 \r
375                 } catch (Exception ex) {\r
376                         // try error in method block\r
377                         String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage()\r
378                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
379                 }\r
380         }\r
381 \r
382         public void prepareFalloutRequest(Execution execution){\r
383                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
384                 utils.log("DEBUG", " *** STARTED DeleteVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled)\r
385 \r
386                 try {\r
387                         WorkflowException wfex = execution.getVariable("WorkflowException")\r
388                         utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)\r
389                         String requestInfo = execution.getVariable(Prefix+"requestInfo")\r
390                         utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)\r
391 \r
392                         String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)\r
393 \r
394                         execution.setVariable(Prefix+"falloutRequest", falloutRequest)\r
395                 } catch (Exception ex) {\r
396                         utils.log("DEBUG", "Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)\r
397                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeResCustService prepareFalloutRequest Process")\r
398                 }\r
399                 utils.log("DEBUG", "*** COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled)\r
400         }\r
401 \r
402 \r
403         public void sendSyncError (Execution execution) {\r
404                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
405                 utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
406 \r
407                 try {\r
408                         String errorMessage = ""\r
409                         if (execution.getVariable("WorkflowException") instanceof WorkflowException) {\r
410                                 WorkflowException wfe = execution.getVariable("WorkflowException")\r
411                                 errorMessage = wfe.getErrorMessage()\r
412                         } else {\r
413                                 errorMessage = "Sending Sync Error."\r
414                         }\r
415 \r
416                         String buildworkflowException =\r
417                                 """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">\r
418                                         <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>\r
419                                         <aetgt:ErrorCode>7000</aetgt:ErrorCode>\r
420                                    </aetgt:WorkflowException>"""\r
421 \r
422                         utils.logAudit(buildworkflowException)\r
423                         sendWorkflowResponse(execution, 500, buildworkflowException)\r
424                 } catch (Exception ex) {\r
425                         utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)\r
426                 }\r
427         }\r
428 \r
429         public void processJavaException(Execution execution){\r
430                 def isDebugEnabled=execution.getVariable(DebugFlag)\r
431                 execution.setVariable("prefix",Prefix)\r
432                 try{\r
433                         utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)\r
434                         utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)\r
435                         utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)\r
436                         execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception")  // Adding this line temporarily until this flows error handling gets updated\r
437                         exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")\r
438                 }catch(BpmnError b){\r
439                         utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)\r
440                         throw b\r
441                 }catch(Exception e){\r
442                         utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)\r
443                         execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method")  // Adding this line temporarily until this flows error handling gets updated\r
444                         exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")\r
445                 }\r
446                 utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)\r
447         }\r
448 \r
449 \r
450 }\r