2 * ============LICENSE_START=======================================================
\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
11 * http://www.apache.org/licenses/LICENSE-2.0
\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
21 package org.openecomp.mso.bpmn.infrastructure.scripts;
\r
23 import groovy.json.JsonSlurper
\r
24 import groovy.json.JsonOutput
\r
26 import org.camunda.bpm.engine.delegate.BpmnError
\r
27 import org.camunda.bpm.engine.delegate.DelegateExecution
\r
28 import org.onap.appc.client.lcm.model.Action
\r
29 import org.apache.commons.lang3.*
\r
30 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
\r
31 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
\r
32 import org.openecomp.mso.bpmn.common.scripts.NetworkUtils;
\r
33 import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils;
\r
34 import org.openecomp.mso.bpmn.common.scripts.VidUtils;
\r
35 import org.openecomp.mso.bpmn.core.RollbackData
\r
36 import org.openecomp.mso.bpmn.core.WorkflowException
\r
37 import org.openecomp.mso.bpmn.core.json.JsonUtils
\r
38 import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources;
\r
39 import org.onap.aai.domain.yang.v12.GenericVnf;
\r
41 public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
\r
43 ExceptionUtil exceptionUtil = new ExceptionUtil()
\r
44 JsonUtils jsonUtil = new JsonUtils()
\r
47 * Validates the request message and sets up the workflow.
\r
48 * @param execution the execution
\r
50 public void preProcessRequest(DelegateExecution execution) {
\r
51 def method = getClass().getSimpleName() + '.preProcessRequest(' +
\r
52 'execution=' + execution.getId() +
\r
54 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
55 logDebug('Entered ' + method, isDebugLogEnabled)
\r
57 execution.setVariable("CVFMI_sentSyncResponse", false)
\r
59 def prefix = 'CVFMI_'
\r
60 logDebug('Entered 1' + method, isDebugLogEnabled)
\r
61 execution.setVariable('prefix', prefix)
\r
62 logDebug('Entered 2' + method, isDebugLogEnabled)
\r
63 execution.setVariable("isVidRequest", "false")
\r
65 logDebug("Set variables", isDebugLogEnabled)
\r
67 def rollbackData = execution.getVariable("RollbackData")
\r
68 if (rollbackData == null) {
\r
69 rollbackData = new RollbackData()
\r
71 execution.setVariable("RollbackData", rollbackData)
\r
73 logDebug("Set rollback data", isDebugLogEnabled)
\r
74 def incomingRequest = execution.getVariable('bpmnRequest')
\r
76 utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled)
\r
77 utils.logAudit("CreateVfModule Infra incoming Request: " + incomingRequest)
\r
79 setBasicDBAuthHeader(execution, isDebugLogEnabled)
\r
81 // check if request is xml or json
\r
83 def jsonSlurper = new JsonSlurper()
\r
84 def jsonOutput = new JsonOutput()
\r
85 Map reqMap = jsonSlurper.parseText(incomingRequest)
\r
86 utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled)
\r
88 def serviceInstanceId = execution.getVariable('serviceInstanceId')
\r
89 def vnfId = execution.getVariable('vnfId')
\r
91 execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId)
\r
92 execution.setVariable(prefix+'vnfId', vnfId)
\r
93 execution.setVariable("isVidRequest", "true")
\r
96 def asdcServiceModelVersion = ''
\r
97 def serviceModelInfo = null
\r
98 def vnfModelInfo = null
\r
100 def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList
\r
102 if (relatedInstanceList != null) {
\r
103 relatedInstanceList.each {
\r
104 if (it.relatedInstance.modelInfo?.modelType == 'service') {
\r
105 asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
\r
106 serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
\r
109 if (it.relatedInstance.modelInfo.modelType == 'vnf') {
\r
110 vnfName = it.relatedInstance.instanceName ?: ''
\r
111 vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
\r
116 execution.setVariable(prefix + 'vnfName', vnfName)
\r
117 execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion)
\r
118 execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo)
\r
119 execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo)
\r
122 def vnfType = execution.getVariable('vnfType')
\r
123 execution.setVariable(prefix + 'vnfType', vnfType)
\r
124 def vfModuleId = execution.getVariable('vfModuleId')
\r
125 execution.setVariable(prefix + 'vfModuleId', vfModuleId)
\r
126 def volumeGroupId = execution.getVariable('volumeGroupId')
\r
127 execution.setVariable(prefix + 'volumeGroupId', volumeGroupId)
\r
128 def userParams = reqMap.requestDetails?.requestParameters?.userParams
\r
130 Map<String, String> userParamsMap = [:]
\r
131 if (userParams != null) {
\r
132 userParams.each { userParam ->
\r
133 userParamsMap.put(userParam.name, jsonOutput.toJson(userParam.value).toString())
\r
137 utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled)
\r
139 execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
\r
141 def isBaseVfModule = "false"
\r
142 if (execution.getVariable('isBaseVfModule') == true) {
\r
143 isBaseVfModule = "true"
\r
146 execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule)
\r
148 def requestId = execution.getVariable("mso-request-id")
\r
149 execution.setVariable(prefix + 'requestId', requestId)
\r
151 def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)
\r
152 execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo)
\r
154 def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback
\r
157 def backoutOnFailure = ""
\r
158 if(suppressRollback != null){
\r
159 if ( suppressRollback == true) {
\r
160 backoutOnFailure = "false"
\r
161 } else if ( suppressRollback == false) {
\r
162 backoutOnFailure = "true"
\r
166 execution.setVariable('disableRollback', suppressRollback)
\r
168 def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null
\r
169 execution.setVariable(prefix + 'vfModuleName', vfModuleName)
\r
171 def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: ''
\r
172 execution.setVariable(prefix + 'serviceId', serviceId)
\r
174 def usePreload = reqMap.requestDetails?.requestParameters?.usePreload
\r
175 execution.setVariable(prefix + 'usePreload', usePreload)
\r
177 // This is aLaCarte flow, so aLaCarte flag is always on
\r
178 execution.setVariable(prefix + 'aLaCarte', true)
\r
180 def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
\r
181 def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
\r
182 execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)
\r
183 def tenantId = cloudConfiguration.tenantId
\r
184 execution.setVariable(prefix + 'tenantId', tenantId)
\r
186 def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: ''
\r
187 execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId)
\r
189 execution.setVariable(prefix + 'sdncVersion', '1702')
\r
191 execution.setVariable("CreateVfModuleInfraSuccessIndicator", false)
\r
192 execution.setVariable("RollbackCompleted", false)
\r
194 execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
\r
197 def source = reqMap.requestDetails?.requestInfo?.source
\r
198 execution.setVariable("CVFMI_source", source)
\r
200 //For Completion Handler & Fallout Handler
\r
201 String requestInfo =
\r
202 """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
\r
203 <request-id>${requestId}</request-id>
\r
204 <action>CREATE</action>
\r
205 <source>${source}</source>
\r
208 execution.setVariable("CVFMI_requestInfo", requestInfo)
\r
212 execution.setVariable("CVFMI_originalWorkflowException", null)
\r
215 def newVfModuleId = UUID.randomUUID().toString()
\r
216 execution.setVariable("newVfModuleId", newVfModuleId)
\r
217 execution.setVariable(prefix + 'vfModuleId', newVfModuleId)
\r
218 execution.setVariable('actionHealthCheck', Action.HealthCheck)
\r
219 execution.setVariable('actionConfigScaleOut', Action.ConfigScaleOut)
\r
220 def controllerType = execution.getVariable('controllerType')
\r
221 execution.setVariable(prefix + 'controllerType', controllerType)
\r
222 execution.setVariable('healthCheckIndex0', 0)
\r
224 logDebug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"), isDebugLogEnabled)
\r
226 logDebug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"), isDebugLogEnabled)
\r
228 logDebug('Exited ' + method, isDebugLogEnabled)
\r
229 } catch (BpmnError bpmnError) {
\r
232 catch(groovy.json.JsonException je) {
\r
233 utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled)
\r
234 exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
\r
236 catch(Exception e) {
\r
237 String restFaultMessage = e.getMessage()
\r
238 //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)
\r
239 //execution.setVariable("CVFMODVOL2_isDataOk", false)
\r
240 utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled)
\r
241 exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
\r
247 * Validates a workflow response.
\r
248 * @param execution the execution
\r
249 * @param responseVar the execution variable in which the response is stored
\r
250 * @param responseCodeVar the execution variable in which the response code is stored
\r
251 * @param errorResponseVar the execution variable in which the error response is stored
\r
253 public void validateWorkflowResponse(DelegateExecution execution, String responseVar,
\r
254 String responseCodeVar, String errorResponseVar) {
\r
255 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
\r
256 sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar)
\r
261 * Sends the empty, synchronous response back to the API Handler.
\r
262 * @param execution the execution
\r
264 public void sendResponse(DelegateExecution execution) {
\r
265 def method = getClass().getSimpleName() + '.sendResponse(' +
\r
266 'execution=' + execution.getId() +
\r
268 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
269 logDebug('Entered ' + method, isDebugLogEnabled)
\r
272 def requestInfo = execution.getVariable('CVFMI_requestInfo')
\r
273 def requestId = execution.getVariable('CVFMI_requestId')
\r
274 def source = execution.getVariable('CVFMI_source')
\r
276 // RESTResponse (for API Handler (APIH) Reply Task)
\r
277 def newVfModuleId = execution.getVariable("newVfModuleId")
\r
278 String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim()
\r
280 sendWorkflowResponse(execution, 200, synchResponse)
\r
282 execution.setVariable("CVFMI_sentSyncResponse", true)
\r
283 utils.logAudit("CreateVfModule Infra Response: " + synchResponse)
\r
284 logDebug('Exited ' + method, isDebugLogEnabled)
\r
285 } catch (BpmnError e) {
\r
287 } catch (Exception e) {
\r
288 logError('Caught exception in ' + method, e)
\r
289 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
\r
294 * Query AAI for vnf orchestration status to determine if health check and config scaling should be run
\r
296 public void queryAAIForVnfOrchestrationStatus(DelegateExecution execution) {
\r
297 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
298 def vnfId = execution.getVariable("CVFMI_vnfId")
\r
299 execution.setVariable("runHealthCheck", false);
\r
300 execution.setVariable("runConfigScaleOut", false);
\r
301 AAICreateResources aaiCreateResources = new AAICreateResources();
\r
302 Optional<GenericVnf> vnf = aaiCreateResources.getVnfInstance(vnfId);
\r
303 if(vnf.isPresent()){
\r
304 def vnfOrchestrationStatus = vnf.get().getOrchestrationStatus();
\r
305 if("active".equalsIgnoreCase(vnfOrchestrationStatus)){
\r
306 execution.setVariable("runHealthCheck", true);
\r
307 execution.setVariable("runConfigScaleOut", true);
\r
314 * @param execution the execution
\r
316 public void postProcessResponse(DelegateExecution execution){
\r
317 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
319 utils.log("DEBUG", " ======== STARTED PostProcessResponse Process ======== ", isDebugEnabled)
\r
321 def requestInfo = execution.getVariable("CVFMI_requestInfo")
\r
322 def action = utils.getNodeText1(requestInfo, "action")
\r
324 utils.log("DEBUG", "requestInfo is: " + requestInfo, isDebugEnabled)
\r
325 utils.log("DEBUG", "action is: " + action, isDebugEnabled)
\r
328 """ <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
\r
329 xmlns:ns="http://org.openecomp/mso/request/types/v1"
\r
330 xmlns:ns8="http://org.openecomp/mso/workflow/schema/v1">
\r
331 <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
\r
334 <ns8:status-message>Vf Module has been created successfully.</ns8:status-message>
\r
335 <ns8:mso-bpel-name>BPMN</ns8:mso-bpel-name>
\r
336 </aetgt:MsoCompletionRequest>"""
\r
338 payload = utils.formatXml(payload)
\r
339 execution.setVariable("CVFMI_SuccessFlag", true)
\r
340 execution.setVariable("CVFMI_msoCompletionRequest", payload)
\r
341 utils.logAudit("CreateVfModuleInfra completion request: " + payload)
\r
342 utils.log("DEBUG", "Outgoing MsoCompletionRequest: \n" + payload, isDebugEnabled)
\r
344 }catch(Exception e){
\r
345 utils.log("ERROR", "Exception Occured Processing PostProcessResponse. Exception is:\n" + e, isDebugEnabled)
\r
346 execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
\r
348 utils.log("DEBUG", "======== COMPLETED PostProcessResponse Process ======== ", isDebugEnabled)
\r
356 * Validates the request, request id and service instance id. If a problem is found,
\r
357 * a WorkflowException is generated and an MSOWorkflowException event is thrown. This
\r
358 * method also sets up the log context for the workflow.
\r
359 * @param execution the execution
\r
360 * @return the validated request
\r
362 public String validateInfraRequest(DelegateExecution execution) {
\r
363 def method = getClass().getSimpleName() + '.validateInfraRequest(' +
\r
364 'execution=' + execution.getId() +
\r
366 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
367 logDebug('Entered ' + method, isDebugLogEnabled)
\r
369 String processKey = getProcessKey(execution);
\r
370 def prefix = execution.getVariable("prefix")
\r
372 if (prefix == null) {
\r
373 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")
\r
377 def request = execution.getVariable(prefix + 'Request')
\r
379 if (request == null) {
\r
380 request = execution.getVariable(processKey + 'Request')
\r
382 if (request == null) {
\r
383 request = execution.getVariable('bpmnRequest')
\r
386 setVariable(execution, processKey + 'Request', null);
\r
387 setVariable(execution, 'bpmnRequest', null);
\r
388 setVariable(execution, prefix + 'Request', request);
\r
391 if (request == null) {
\r
392 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
\r
397 def requestId = execution.getVariable("mso-request-id")
\r
399 if (requestId == null) {
\r
400 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id")
\r
403 setVariable(execution, prefix + 'requestId', requestId)
\r
405 def serviceInstanceId = execution.getVariable("mso-service-instance-id")
\r
407 if (serviceInstanceId == null) {
\r
408 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id")
\r
411 utils.logContext(requestId, serviceInstanceId)
\r
413 utils.logAudit("CreateVfModule incoming request: " + request)
\r
414 logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
\r
415 logDebug('Exited ' + method, isDebugLogEnabled)
\r
417 } catch (BpmnError e) {
\r
419 } catch (Exception e) {
\r
420 logError('Caught exception in ' + method, e)
\r
421 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
\r
425 public void prepareUpdateInfraRequest(DelegateExecution execution){
\r
426 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
\r
428 utils.log("DEBUG", " ======== STARTED prepareUpdateInfraRequest Process ======== ", isDebugEnabled)
\r
432 String requestInfo = execution.getVariable("CVFMI_requestInfo")
\r
433 def aicCloudRegion = execution.getVariable("CVFMI_lcpCloudRegionId")
\r
434 def tenantId = execution.getVariable("CVFMI_tenantId")
\r
435 def requestId = utils.getNodeText1(requestInfo, "request-id")
\r
436 def vnfId = execution.getVariable("CVFMI_vnfId")
\r
437 def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
\r
438 // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input
\r
439 def vfModuleName = execution.getVariable("CVFMI_vfModuleName")
\r
441 def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
\r
442 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
\r
443 utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
\r
446 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
\r
447 xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
450 <ns:updateInfraRequest xmlns:ns="http://org.openecomp.mso/requestsdb">
\r
451 <requestId>${requestId}</requestId>
\r
452 <lastModifiedBy>BPMN</lastModifiedBy>
\r
453 <statusMessage>VF Module successfully created</statusMessage>
\r
454 <responseBody></responseBody>
\r
455 <requestStatus>COMPLETE</requestStatus>
\r
456 <progress>100</progress>
\r
457 <vnfOutputs><vnf-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${vnfId}</vnf-id><vf-module-id>${vfModuleId}</vf-module-id></vnf-outputs></vnfOutputs>
\r
458 <vfModuleId>${vfModuleId}</vfModuleId>
\r
459 <vfModuleName>${vfModuleName}</vfModuleName>
\r
460 </ns:updateInfraRequest>
\r
462 </soapenv:Envelope>"""
\r
464 payload = utils.formatXml(payload)
\r
465 execution.setVariable("CVFMI_updateInfraRequest", payload)
\r
466 utils.log("DEBUG", "Outgoing UpdateInfraRequest: \n" + payload, isDebugEnabled)
\r
467 utils.logAudit("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
\r
469 }catch(Exception e){
\r
470 utils.log("ERROR", "Exception Occured Processing prepareUpdateInfraRequest. Exception is:\n" + e, isDebugEnabled)
\r
471 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
\r
473 utils.log("DEBUG", "======== COMPLETED prepareUpdateInfraRequest Process ======== ", isDebugEnabled)
\r
477 * Builds a "FalloutHandler" request and stores it in the specified execution variable.
\r
479 * @param execution the execution
\r
480 * @param resultVar the execution variable in which the result will be stored
\r
482 public void falloutHandlerPrep(DelegateExecution execution, String resultVar) {
\r
483 def method = getClass().getSimpleName() + '.falloutHandlerPrep(' +
\r
484 'execution=' + execution.getId() +
\r
485 ', resultVar=' + resultVar +
\r
487 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
488 logDebug('Entered ' + method, isDebugLogEnabled)
\r
492 def WorkflowException workflowException = execution.getVariable("WorkflowException")
\r
493 def requestInformation = execution.getVariable("CVFMI_requestInfo")
\r
494 def errorResponseCode = workflowException.getErrorCode()
\r
495 def errorResponseMsg = workflowException.getErrorMessage()
\r
496 def encErrorResponseMsg = ""
\r
497 if (errorResponseMsg != null) {
\r
498 encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">")
\r
501 String content = """
\r
502 <aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
\r
503 xmlns:reqtype="http://org.openecomp/mso/request/types/v1"
\r
504 xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"
\r
505 xmlns:structuredtypes="http://org.openecomp/mso/structured/types/v1">
\r
506 ${requestInformation}
\r
507 <aetgt:WorkflowException>
\r
508 <aetgt:ErrorMessage>${encErrorResponseMsg}</aetgt:ErrorMessage>
\r
509 <aetgt:ErrorCode>${errorResponseCode}</aetgt:ErrorCode>
\r
510 </aetgt:WorkflowException>
\r
511 </aetgt:FalloutHandlerRequest>
\r
514 logDebug("CONTENT before translation: " + content, isDebugLogEnabled)
\r
515 content = utils.formatXml(content)
\r
516 logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)
\r
517 utils.logAudit("CreateVfModuleInfra FallOutHander Request: " + content)
\r
518 execution.setVariable(resultVar, content)
\r
520 logDebug('Exited ' + method, isDebugLogEnabled)
\r
521 } catch (BpmnError e) {
\r
523 } catch (Exception e) {
\r
524 logError('Caught exception in ' + method, e)
\r
525 exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
\r
529 public void logAndSaveOriginalException(DelegateExecution execution) {
\r
530 def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
\r
531 'execution=' + execution.getId() +
\r
533 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
534 logDebug('Entered ' + method, isDebugLogEnabled)
\r
536 logWorkflowException(execution, 'CreateVfModuleInfra caught an event')
\r
537 saveWorkflowException(execution, 'CVFMI_originalWorkflowException')
\r
540 public void validateRollbackResponse(DelegateExecution execution) {
\r
541 def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
\r
542 'execution=' + execution.getId() +
\r
544 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
545 logDebug('Entered ' + method, isDebugLogEnabled)
\r
547 def originalException = execution.getVariable("CVFMI_originalWorkflowException")
\r
548 execution.setVariable("WorkflowException", originalException)
\r
550 execution.setVariable("RollbackCompleted", true)
\r
554 public void sendErrorResponse(DelegateExecution execution){
\r
555 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
\r
557 utils.log("DEBUG", " *** STARTED CreateVfModulenfra sendErrorResponse Process *** ", isDebugEnabled)
\r
559 def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse")
\r
560 if(sentSyncResponse == false){
\r
561 WorkflowException wfex = execution.getVariable("WorkflowException")
\r
562 String response = exceptionUtil.buildErrorResponseXml(wfex)
\r
564 utils.logAudit(response)
\r
565 sendWorkflowResponse(execution, 500, response)
\r
567 utils.log("DEBUG", "Not Sending Error Response. Sync Response Already Sent", isDebugEnabled)
\r
570 } catch (Exception ex) {
\r
571 utils.log("DEBUG", "Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage(), isDebugEnabled)
\r
572 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process")
\r
575 utils.log("DEBUG", "*** COMPLETED CreateVfModuleInfra sendErrorResponse Process ***", isDebugEnabled)
\r