2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.bpmn.infrastructure.scripts
25 import org.camunda.bpm.engine.delegate.BpmnError
26 import org.camunda.bpm.engine.delegate.DelegateExecution
27 import org.onap.aai.domain.yang.v12.GenericVnf;
28 import org.onap.appc.client.lcm.model.Action
29 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
30 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
31 import org.onap.so.bpmn.common.scripts.MsoUtils
32 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils;
33 import org.onap.so.bpmn.core.RollbackData
34 import org.onap.so.bpmn.core.UrnPropertiesReader
35 import org.onap.so.bpmn.core.WorkflowException
36 import org.onap.so.bpmn.core.json.JsonUtils
37 import org.onap.so.bpmn.infrastructure.aai.AAICreateResources
38 import org.onap.so.logger.ErrorCode;
39 import org.onap.so.logger.MessageEnum
40 import org.slf4j.Logger
41 import org.slf4j.LoggerFactory
43 import javax.xml.parsers.*
44 import org.xml.sax.InputSource
45 import groovy.json.JsonOutput
46 import groovy.json.JsonSlurper
48 public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
49 private static final Logger logger = LoggerFactory.getLogger( CreateVfModuleInfra.class);
51 ExceptionUtil exceptionUtil = new ExceptionUtil()
52 JsonUtils jsonUtil = new JsonUtils()
54 private AbstractServiceTaskProcessor taskProcessor
56 public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
57 this.taskProcessor = taskProcessor
61 * Validates the request message and sets up the workflow.
62 * @param execution the execution
64 public void preProcessRequest(DelegateExecution execution) {
65 def method = getClass().getSimpleName() + '.preProcessRequest(' +
66 'execution=' + execution.getId() +
69 logger.debug('Started ' + method)
70 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
72 execution.setVariable("CVFMI_sentSyncResponse", false)
75 execution.setVariable('prefix', prefix)
76 execution.setVariable("isVidRequest", "false")
78 def rollbackData = execution.getVariable("RollbackData")
79 if (rollbackData == null) {
80 rollbackData = new RollbackData()
82 execution.setVariable("RollbackData", rollbackData)
84 def incomingRequest = execution.getVariable('bpmnRequest')
85 logger.debug("Incoming Infra Request: " + incomingRequest)
86 logger.debug("CreateVfModule Infra incoming Request: " + incomingRequest)
88 setBasicDBAuthHeader(execution, isDebugLogEnabled)
90 // check if request is xml or json
92 def jsonSlurper = new JsonSlurper()
93 def jsonOutput = new JsonOutput()
94 Map reqMap = jsonSlurper.parseText(incomingRequest)
95 logger.debug(" Request is in JSON format.")
97 def serviceInstanceId = execution.getVariable('serviceInstanceId')
98 def vnfId = execution.getVariable('vnfId')
100 execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId)
101 execution.setVariable(prefix+'vnfId', vnfId)
102 execution.setVariable("isVidRequest", "true")
105 def asdcServiceModelVersion = ''
106 def serviceModelInfo = null
107 def vnfModelInfo = null
109 def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList
111 if (relatedInstanceList != null) {
112 relatedInstanceList.each {
113 if (it.relatedInstance.modelInfo?.modelType == 'service') {
114 asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
115 serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
118 if (it.relatedInstance.modelInfo.modelType == 'vnf') {
119 vnfName = it.relatedInstance.instanceName ?: ''
120 vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
125 execution.setVariable(prefix + 'vnfName', vnfName)
126 execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion)
127 execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo)
128 execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo)
131 def vnfType = execution.getVariable('vnfType')
132 execution.setVariable(prefix + 'vnfType', vnfType)
133 def vfModuleId = execution.getVariable('vfModuleId')
134 execution.setVariable(prefix + 'vfModuleId', vfModuleId)
135 def volumeGroupId = execution.getVariable('volumeGroupId')
136 execution.setVariable(prefix + 'volumeGroupId', volumeGroupId)
137 def userParams = reqMap.requestDetails?.requestParameters?.userParams
139 Map<String, String> userParamsMap = [:]
140 if (userParams != null) {
141 userParams.each { userParam ->
142 userParamsMap.put(userParam.name, userParam.value.toString())
146 logger.debug('Processed user params: ' + userParamsMap)
148 execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
150 def isBaseVfModule = "false"
151 if (execution.getVariable('isBaseVfModule') == true) {
152 isBaseVfModule = "true"
155 execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule)
157 def requestId = execution.getVariable("mso-request-id")
158 execution.setVariable(prefix + 'requestId', requestId)
160 def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)
161 execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo)
163 def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback
166 def backoutOnFailure = ""
167 if(suppressRollback != null){
168 if ( suppressRollback == true) {
169 backoutOnFailure = "false"
170 } else if ( suppressRollback == false) {
171 backoutOnFailure = "true"
175 execution.setVariable('disableRollback', suppressRollback)
177 def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null
178 execution.setVariable(prefix + 'vfModuleName', vfModuleName)
180 def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: ''
181 execution.setVariable(prefix + 'serviceId', serviceId)
183 def usePreload = reqMap.requestDetails?.requestParameters?.usePreload
184 execution.setVariable(prefix + 'usePreload', usePreload)
186 // This is aLaCarte flow, so aLaCarte flag is always on
187 execution.setVariable(prefix + 'aLaCarte', true)
189 def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
190 def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
191 execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)
193 def cloudOwner = cloudConfiguration.cloudOwner
194 execution.setVariable(prefix + 'cloudOwner', cloudOwner)
196 def tenantId = cloudConfiguration.tenantId
197 execution.setVariable(prefix + 'tenantId', tenantId)
199 def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: ''
200 execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId)
202 execution.setVariable(prefix + 'sdncVersion', '1702')
204 execution.setVariable("CreateVfModuleInfraSuccessIndicator", false)
205 execution.setVariable("RollbackCompleted", false)
207 execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
210 def source = reqMap.requestDetails?.requestInfo?.source
211 execution.setVariable("CVFMI_source", source)
213 //For Completion Handler & Fallout Handler
215 """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
216 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
217 <action>CREATE</action>
218 <source>${MsoUtils.xmlEscape(source)}</source>
221 execution.setVariable("CVFMI_requestInfo", requestInfo)
225 execution.setVariable("CVFMI_originalWorkflowException", null)
228 def newVfModuleId = UUID.randomUUID().toString()
229 execution.setVariable("newVfModuleId", newVfModuleId)
230 execution.setVariable(prefix + 'vfModuleId', newVfModuleId)
231 execution.setVariable('actionHealthCheck', Action.HealthCheck)
232 execution.setVariable('actionConfigScaleOut', Action.ConfigScaleOut)
233 execution.setVariable('controllerType', "APPC")
234 def controllerType = execution.getVariable('controllerType')
235 execution.setVariable(prefix + 'controllerType', controllerType)
236 execution.setVariable('healthCheckIndex0', 0)
238 logger.debug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"))
240 logger.debug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"))
242 logger.trace('Finished ' + method)
243 } catch (BpmnError bpmnError) {
246 catch(groovy.json.JsonException je) {
247 logger.debug("Request is not in JSON format.")
248 exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
251 String restFaultMessage = e.getMessage()
252 //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)
253 //execution.setVariable("CVFMODVOL2_isDataOk", false)
254 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
255 " Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
256 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
257 exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
263 * Validates a workflow response.
264 * @param execution the execution
265 * @param responseVar the execution variable in which the response is stored
266 * @param responseCodeVar the execution variable in which the response code is stored
267 * @param errorResponseVar the execution variable in which the error response is stored
269 public void validateWorkflowResponse(DelegateExecution execution, String responseVar,
270 String responseCodeVar, String errorResponseVar) {
271 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
272 sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar)
277 * Sends the empty, synchronous response back to the API Handler.
278 * @param execution the execution
280 public void sendResponse(DelegateExecution execution) {
281 def method = getClass().getSimpleName() + '.sendResponse(' +
282 'execution=' + execution.getId() +
285 logger.trace('Started ' + method)
288 def requestInfo = execution.getVariable('CVFMI_requestInfo')
289 def requestId = execution.getVariable('CVFMI_requestId')
290 def source = execution.getVariable('CVFMI_source')
292 // RESTResponse (for API Handler (APIH) Reply Task)
293 def newVfModuleId = execution.getVariable("newVfModuleId")
294 String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim()
296 sendWorkflowResponse(execution, 200, synchResponse)
298 execution.setVariable("CVFMI_sentSyncResponse", true)
299 logger.debug("CreateVfModule Infra Response: " + synchResponse)
300 logger.trace('Finished ' + method)
301 } catch (BpmnError e) {
303 } catch (Exception e) {
304 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
305 "Exception Encountered ", "BPMN",
306 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
307 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
312 * Query AAI for vnf orchestration status to determine if health check and config scaling should be run
314 public void queryAAIForVnfOrchestrationStatus(DelegateExecution execution) {
315 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
316 def vnfId = execution.getVariable("CVFMI_vnfId")
317 execution.setVariable("runHealthCheck", false);
318 execution.setVariable("runConfigScaleOut", false);
319 AAICreateResources aaiCreateResources = new AAICreateResources();
320 Optional<GenericVnf> vnf = aaiCreateResources.getVnfInstance(vnfId);
322 def vnfOrchestrationStatus = vnf.get().getOrchestrationStatus();
323 if("active".equalsIgnoreCase(vnfOrchestrationStatus)){
324 execution.setVariable("runHealthCheck", false);
325 execution.setVariable("runConfigScaleOut", true);
331 * Retrieve data for ConfigScaleOut from SDNC topology
334 public void retreiveConfigScaleOutData(DelegateExecution execution){
335 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
336 def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
337 String ipAddress = "";
338 String oamIpAddress = "";
339 String vnfHostIpAddress = "";
341 String vnfGetSDNC = execution.getVariable("DCVFM_getSDNCAdapterResponse");
343 String data = utils.getNodeXml(vnfGetSDNC, "response-data")
344 data = data.replaceAll("<", "<")
345 data = data.replaceAll(">", ">")
347 InputSource source = new InputSource(new StringReader(data));
348 DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
349 docFactory.setNamespaceAware(true)
350 DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
351 Document responseXml = docBuilder.parse(source)
353 NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
354 for (int z = 0; z < paramsList.getLength(); z++) {
355 Node node = paramsList.item(z)
356 Element eElement = (Element) node
357 String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
358 String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
359 if (vnfParameterName.equals("vlb_private_ip_1")) {
360 vnfHostIpAddress = vnfParameterValue
362 else if (vnfParameterName.equals("vdns_private_ip_0")) {
363 ipAddress = vnfParameterValue
365 else if (vnfParameterName.equals("vdns_private_ip_1")) {
366 oamIpAddress = vnfParameterValue
370 String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"" + vnfHostIpAddress + "\",\"vf-module-id\":\"" + vfModuleId + "\"},\"configuration-parameters\":{\"ip-addr\":\"" + ipAddress +"\", \"oam-ip-addr\":\""+ oamIpAddress +"\",\"enabled\":\"true\"}}"
371 execution.setVariable("payload", payload);
376 * @param execution the execution
378 public void postProcessResponse(DelegateExecution execution){
379 logger.trace("STARTED PostProcessResponse Process")
381 def requestInfo = execution.getVariable("CVFMI_requestInfo")
382 def action = utils.getNodeText(requestInfo, "action")
384 logger.debug("requestInfo is: " + requestInfo)
385 logger.debug("action is: " + action)
388 """ <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
389 xmlns:ns="http://org.onap/so/request/types/v1"
390 xmlns:ns8="http://org.onap/so/workflow/schema/v1">
391 <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
394 <ns8:status-message>Vf Module has been created successfully.</ns8:status-message>
395 <ns8:mso-bpel-name>BPMN</ns8:mso-bpel-name>
396 </aetgt:MsoCompletionRequest>"""
398 payload = utils.formatXml(payload)
399 execution.setVariable("CVFMI_SuccessFlag", true)
400 execution.setVariable("CVFMI_msoCompletionRequest", payload)
401 logger.debug("CreateVfModuleInfra completion request: " + payload)
402 logger.debug("Outgoing MsoCompletionRequest: \n" + payload)
405 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
406 "Exception Occured Processing PostProcessResponse - " + "\n", "BPMN",
407 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
408 execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
410 logger.trace("COMPLETED PostProcessResponse Process")
418 * Validates the request, request id and service instance id. If a problem is found,
419 * a WorkflowException is generated and an MSOWorkflowException event is thrown. This
420 * method also sets up the log context for the workflow.
421 * @param execution the execution
422 * @return the validated request
424 public String validateInfraRequest(DelegateExecution execution) {
425 def method = getClass().getSimpleName() + '.validateInfraRequest(' +
426 'execution=' + execution.getId() +
429 logger.trace('Started ' + method)
431 String processKey = getProcessKey(execution);
432 def prefix = execution.getVariable("prefix")
434 if (prefix == null) {
435 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")
439 def request = execution.getVariable(prefix + 'Request')
441 if (request == null) {
442 request = execution.getVariable(processKey + 'Request')
444 if (request == null) {
445 request = execution.getVariable('bpmnRequest')
448 setVariable(execution, processKey + 'Request', null);
449 setVariable(execution, 'bpmnRequest', null);
450 setVariable(execution, prefix + 'Request', request);
453 if (request == null) {
454 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
459 def requestId = execution.getVariable("mso-request-id")
461 if (requestId == null) {
462 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id")
465 setVariable(execution, prefix + 'requestId', requestId)
467 def serviceInstanceId = execution.getVariable("mso-service-instance-id")
469 if (serviceInstanceId == null) {
470 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id")
473 utils.logContext(requestId, serviceInstanceId)
475 logger.debug("CreateVfModule incoming request: " + request)
476 logger.debug('Incoming message: ' + System.lineSeparator() + request)
477 logger.trace('Finished ' + method)
479 } catch (BpmnError e) {
481 } catch (Exception e) {
482 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
483 "Caught exception in " + method , "BPMN",
484 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
485 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
489 public void prepareUpdateInfraRequest(DelegateExecution execution){
490 logger.trace("STARTED prepareUpdateInfraRequest Process")
493 String requestInfo = execution.getVariable("CVFMI_requestInfo")
494 def aicCloudRegion = execution.getVariable("CVFMI_lcpCloudRegionId")
495 def tenantId = execution.getVariable("CVFMI_tenantId")
496 def requestId = utils.getNodeText(requestInfo, "request-id")
497 def vnfId = execution.getVariable("CVFMI_vnfId")
498 def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
499 // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input
500 def vfModuleName = execution.getVariable("CVFMI_vfModuleName")
502 def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
503 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
504 logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
507 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
508 xmlns:ns="http://org.onap.so/requestsdb">
511 <ns:updateInfraRequest xmlns:ns="http://org.onap.so/requestsdb">
512 <requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
513 <lastModifiedBy>BPMN</lastModifiedBy>
514 <statusMessage>VF Module successfully created</statusMessage>
515 <responseBody></responseBody>
516 <requestStatus>COMPLETE</requestStatus>
517 <progress>100</progress>
518 <vnfOutputs><vnf-outputs xmlns="http://org.onap/so/infra/vnf-request/v1" xmlns:aetgt="http://org.onap/so/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id><vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id></vnf-outputs></vnfOutputs>
519 <vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
520 <vfModuleName>${MsoUtils.xmlEscape(vfModuleName)}</vfModuleName>
521 </ns:updateInfraRequest>
523 </soapenv:Envelope>"""
525 payload = utils.formatXml(payload)
526 execution.setVariable("CVFMI_updateInfraRequest", payload)
527 logger.debug("Outgoing UpdateInfraRequest: \n" + payload)
528 logger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
531 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
532 "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN",
533 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
534 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
536 logger.trace("COMPLETED prepareUpdateInfraRequest Process")
540 * Builds a "FalloutHandler" request and stores it in the specified execution variable.
542 * @param execution the execution
543 * @param resultVar the execution variable in which the result will be stored
545 public void falloutHandlerPrep(DelegateExecution execution, String resultVar) {
546 def method = getClass().getSimpleName() + '.falloutHandlerPrep(' +
547 'execution=' + execution.getId() +
548 ', resultVar=' + resultVar +
551 logger.trace("Started " + method)
555 def WorkflowException workflowException = execution.getVariable("WorkflowException")
556 def requestInformation = execution.getVariable("CVFMI_requestInfo")
557 def errorResponseCode = workflowException.getErrorCode()
558 def errorResponseMsg = workflowException.getErrorMessage()
559 def encErrorResponseMsg = ""
560 if (errorResponseMsg != null) {
561 encErrorResponseMsg = errorResponseMsg
565 <aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
566 xmlns:reqtype="http://org.onap/so/request/types/v1"
567 xmlns:msoservtypes="http://org.onap/so/request/types/v1"
568 xmlns:structuredtypes="http://org.onap/so/structured/types/v1">
569 ${requestInformation}
570 <aetgt:WorkflowException>
571 <aetgt:ErrorMessage>${MsoUtils.xmlEscape(encErrorResponseMsg)}</aetgt:ErrorMessage>
572 <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorResponseCode)}</aetgt:ErrorCode>
573 </aetgt:WorkflowException>
574 </aetgt:FalloutHandlerRequest>
577 logger.debug("CONTENT before translation: " + content)
578 content = utils.formatXml(content)
579 logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
580 logger.debug("CreateVfModuleInfra FallOutHander Request: " + content)
581 execution.setVariable(resultVar, content)
583 logger.trace('Exited ' + method)
584 } catch (BpmnError e) {
586 } catch (Exception e) {
587 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
588 "Caught exception in " + method , "BPMN",
589 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
590 exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
594 public void logAndSaveOriginalException(DelegateExecution execution) {
595 def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
596 'execution=' + execution.getId() +
598 logger.trace('Entered ' + method)
600 logWorkflowException(execution, 'CreateVfModuleInfra caught an event')
601 saveWorkflowException(execution, 'CVFMI_originalWorkflowException')
604 public void validateRollbackResponse(DelegateExecution execution) {
605 def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
606 'execution=' + execution.getId() +
608 logger.trace('Entered ' + method)
609 def originalException = execution.getVariable("CVFMI_originalWorkflowException")
610 execution.setVariable("WorkflowException", originalException)
612 execution.setVariable("RollbackCompleted", true)
616 public void sendErrorResponse(DelegateExecution execution){
617 logger.trace("STARTED CreateVfModulenfra sendErrorResponse Process")
619 def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse")
620 if(sentSyncResponse == false){
621 WorkflowException wfex = execution.getVariable("WorkflowException")
622 String response = exceptionUtil.buildErrorResponseXml(wfex)
623 logger.debug(response)
624 sendWorkflowResponse(execution, 500, response)
626 logger.debug("Not Sending Error Response. Sync Response Already Sent")
629 } catch (Exception ex) {
630 logger.debug("Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage())
631 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process")
633 logger.trace("COMPLETED CreateVfModuleInfra sendErrorResponse Process")