2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.infrastructure.scripts;
23 import org.apache.commons.lang3.*
24 import org.camunda.bpm.engine.delegate.BpmnError
25 import org.camunda.bpm.engine.delegate.DelegateExecution
26 import org.onap.aai.domain.yang.v12.GenericVnf;
27 import org.onap.appc.client.lcm.model.Action
28 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
29 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
30 import org.onap.so.bpmn.common.scripts.MsoUtils
31 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils;
32 import org.onap.so.bpmn.core.RollbackData
33 import org.onap.so.bpmn.core.UrnPropertiesReader
34 import org.onap.so.bpmn.core.WorkflowException
35 import org.onap.so.bpmn.core.json.JsonUtils
36 import org.onap.so.bpmn.infrastructure.aai.AAICreateResources;
37 import org.onap.so.logger.MessageEnum
38 import org.onap.so.logger.MsoLogger
40 import groovy.json.JsonOutput
41 import groovy.json.JsonSlurper
43 public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
44 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVfModuleInfra.class);
46 ExceptionUtil exceptionUtil = new ExceptionUtil()
47 JsonUtils jsonUtil = new JsonUtils()
49 private AbstractServiceTaskProcessor taskProcessor
51 public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
52 this.taskProcessor = taskProcessor
56 * Validates the request message and sets up the workflow.
57 * @param execution the execution
59 public void preProcessRequest(DelegateExecution execution) {
60 def method = getClass().getSimpleName() + '.preProcessRequest(' +
61 'execution=' + execution.getId() +
64 msoLogger.debug('Started ' + method)
65 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
67 execution.setVariable("CVFMI_sentSyncResponse", false)
70 execution.setVariable('prefix', prefix)
71 execution.setVariable("isVidRequest", "false")
73 def rollbackData = execution.getVariable("RollbackData")
74 if (rollbackData == null) {
75 rollbackData = new RollbackData()
77 execution.setVariable("RollbackData", rollbackData)
79 def incomingRequest = execution.getVariable('bpmnRequest')
80 msoLogger.debug("Incoming Infra Request: " + incomingRequest)
81 msoLogger.debug("CreateVfModule Infra incoming Request: " + incomingRequest)
83 setBasicDBAuthHeader(execution, isDebugLogEnabled)
85 // check if request is xml or json
87 def jsonSlurper = new JsonSlurper()
88 def jsonOutput = new JsonOutput()
89 Map reqMap = jsonSlurper.parseText(incomingRequest)
90 msoLogger.debug(" Request is in JSON format.")
92 def serviceInstanceId = execution.getVariable('serviceInstanceId')
93 def vnfId = execution.getVariable('vnfId')
95 execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId)
96 execution.setVariable(prefix+'vnfId', vnfId)
97 execution.setVariable("isVidRequest", "true")
100 def asdcServiceModelVersion = ''
101 def serviceModelInfo = null
102 def vnfModelInfo = null
104 def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList
106 if (relatedInstanceList != null) {
107 relatedInstanceList.each {
108 if (it.relatedInstance.modelInfo?.modelType == 'service') {
109 asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
110 serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
113 if (it.relatedInstance.modelInfo.modelType == 'vnf') {
114 vnfName = it.relatedInstance.instanceName ?: ''
115 vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
120 execution.setVariable(prefix + 'vnfName', vnfName)
121 execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion)
122 execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo)
123 execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo)
126 def vnfType = execution.getVariable('vnfType')
127 execution.setVariable(prefix + 'vnfType', vnfType)
128 def vfModuleId = execution.getVariable('vfModuleId')
129 execution.setVariable(prefix + 'vfModuleId', vfModuleId)
130 def volumeGroupId = execution.getVariable('volumeGroupId')
131 execution.setVariable(prefix + 'volumeGroupId', volumeGroupId)
132 def userParams = reqMap.requestDetails?.requestParameters?.userParams
134 Map<String, String> userParamsMap = [:]
135 if (userParams != null) {
136 userParams.each { userParam ->
137 userParamsMap.put(userParam.name, userParam.value.toString())
141 msoLogger.debug('Processed user params: ' + userParamsMap)
143 execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
145 def isBaseVfModule = "false"
146 if (execution.getVariable('isBaseVfModule') == true) {
147 isBaseVfModule = "true"
150 execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule)
152 def requestId = execution.getVariable("mso-request-id")
153 execution.setVariable(prefix + 'requestId', requestId)
155 def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)
156 execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo)
158 def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback
161 def backoutOnFailure = ""
162 if(suppressRollback != null){
163 if ( suppressRollback == true) {
164 backoutOnFailure = "false"
165 } else if ( suppressRollback == false) {
166 backoutOnFailure = "true"
170 execution.setVariable('disableRollback', suppressRollback)
172 def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null
173 execution.setVariable(prefix + 'vfModuleName', vfModuleName)
175 def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: ''
176 execution.setVariable(prefix + 'serviceId', serviceId)
178 def usePreload = reqMap.requestDetails?.requestParameters?.usePreload
179 execution.setVariable(prefix + 'usePreload', usePreload)
181 // This is aLaCarte flow, so aLaCarte flag is always on
182 execution.setVariable(prefix + 'aLaCarte', true)
184 def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
185 def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
186 execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)
187 def tenantId = cloudConfiguration.tenantId
188 execution.setVariable(prefix + 'tenantId', tenantId)
190 def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: ''
191 execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId)
193 execution.setVariable(prefix + 'sdncVersion', '1702')
195 execution.setVariable("CreateVfModuleInfraSuccessIndicator", false)
196 execution.setVariable("RollbackCompleted", false)
198 execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
201 def source = reqMap.requestDetails?.requestInfo?.source
202 execution.setVariable("CVFMI_source", source)
204 //For Completion Handler & Fallout Handler
206 """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
207 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
208 <action>CREATE</action>
209 <source>${MsoUtils.xmlEscape(source)}</source>
212 execution.setVariable("CVFMI_requestInfo", requestInfo)
216 execution.setVariable("CVFMI_originalWorkflowException", null)
219 def newVfModuleId = UUID.randomUUID().toString()
220 execution.setVariable("newVfModuleId", newVfModuleId)
221 execution.setVariable(prefix + 'vfModuleId', newVfModuleId)
222 execution.setVariable('actionHealthCheck', Action.HealthCheck)
223 execution.setVariable('actionConfigScaleOut', Action.ConfigScaleOut)
224 execution.setVariable('controllerType', "APPC")
225 def controllerType = execution.getVariable('controllerType')
226 execution.setVariable(prefix + 'controllerType', controllerType)
227 execution.setVariable('healthCheckIndex0', 0)
229 msoLogger.debug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"))
231 msoLogger.debug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"))
233 msoLogger.trace('Finished ' + method)
234 } catch (BpmnError bpmnError) {
237 catch(groovy.json.JsonException je) {
238 msoLogger.debug("Request is not in JSON format.")
239 exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
242 String restFaultMessage = e.getMessage()
243 //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)
244 //execution.setVariable("CVFMODVOL2_isDataOk", false)
245 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
246 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
247 exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
253 * Validates a workflow response.
254 * @param execution the execution
255 * @param responseVar the execution variable in which the response is stored
256 * @param responseCodeVar the execution variable in which the response code is stored
257 * @param errorResponseVar the execution variable in which the error response is stored
259 public void validateWorkflowResponse(DelegateExecution execution, String responseVar,
260 String responseCodeVar, String errorResponseVar) {
261 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
262 sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar)
267 * Sends the empty, synchronous response back to the API Handler.
268 * @param execution the execution
270 public void sendResponse(DelegateExecution execution) {
271 def method = getClass().getSimpleName() + '.sendResponse(' +
272 'execution=' + execution.getId() +
275 msoLogger.trace('Started ' + method)
278 def requestInfo = execution.getVariable('CVFMI_requestInfo')
279 def requestId = execution.getVariable('CVFMI_requestId')
280 def source = execution.getVariable('CVFMI_source')
282 // RESTResponse (for API Handler (APIH) Reply Task)
283 def newVfModuleId = execution.getVariable("newVfModuleId")
284 String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim()
286 sendWorkflowResponse(execution, 200, synchResponse)
288 execution.setVariable("CVFMI_sentSyncResponse", true)
289 msoLogger.debug("CreateVfModule Infra Response: " + synchResponse)
290 msoLogger.trace('Finished ' + method)
291 } catch (BpmnError e) {
293 } catch (Exception e) {
294 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered ", "BPMN", MsoLogger.getServiceName(),
295 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
296 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
301 * Query AAI for vnf orchestration status to determine if health check and config scaling should be run
303 public void queryAAIForVnfOrchestrationStatus(DelegateExecution execution) {
304 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
305 def vnfId = execution.getVariable("CVFMI_vnfId")
306 execution.setVariable("runHealthCheck", false);
307 execution.setVariable("runConfigScaleOut", false);
308 AAICreateResources aaiCreateResources = new AAICreateResources();
309 Optional<GenericVnf> vnf = aaiCreateResources.getVnfInstance(vnfId);
311 def vnfOrchestrationStatus = vnf.get().getOrchestrationStatus();
312 if("active".equalsIgnoreCase(vnfOrchestrationStatus)){
313 execution.setVariable("runHealthCheck", false);
314 execution.setVariable("runConfigScaleOut", true);
320 * Retrieve data for ConfigScaleOut from SDNC topology
323 public void retreiveConfigScaleOutData(DelegateExecution execution){
324 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
325 def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
326 String ipAddress = "";
327 String oamIpAddress = "";
328 String vnfHostIpAddress = "";
330 String vnfGetSDNC = execution.getVariable("DCVFM_getSDNCAdapterResponse");
332 String data = utils.getNodeXml(vnfGetSDNC, "response-data")
333 data = data.replaceAll("<", "<")
334 data = data.replaceAll(">", ">")
336 InputSource source = new InputSource(new StringReader(data));
337 DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
338 docFactory.setNamespaceAware(true)
339 DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
340 Document responseXml = docBuilder.parse(source)
342 NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
343 for (int z = 0; z < paramsList.getLength(); z++) {
344 Node node = paramsList.item(z)
345 Element eElement = (Element) node
346 String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
347 String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
348 if (vnfParameterName.equals("vlb_private_ip_1")) {
349 vnfHostIpAddress = vnfParameterValue
351 else if (vnfParameterName.equals("vdns_private_ip_0")) {
352 ipAddress = vnfParameterValue
354 else if (vnfParameterName.equals("vdns_private_ip_1")) {
355 oamIpAddress = vnfParameterValue
359 String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"" + vnfHostIpAddress + "\",\"vf-module-id\":\"" + vfModuleId + "\"},\"configuration-parameters\":{\"ip-addr\":\"" + ipAddress +"\", \"oam-ip-addr\":\""+ oamIpAddress +"\",\"enabled\":\"true\"}}"
360 execution.setVariable("payload", payload);
365 * @param execution the execution
367 public void postProcessResponse(DelegateExecution execution){
368 msoLogger.trace("STARTED PostProcessResponse Process")
370 def requestInfo = execution.getVariable("CVFMI_requestInfo")
371 def action = utils.getNodeText(requestInfo, "action")
373 msoLogger.debug("requestInfo is: " + requestInfo)
374 msoLogger.debug("action is: " + action)
377 """ <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
378 xmlns:ns="http://org.onap/so/request/types/v1"
379 xmlns:ns8="http://org.onap/so/workflow/schema/v1">
380 <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
383 <ns8:status-message>Vf Module has been created successfully.</ns8:status-message>
384 <ns8:mso-bpel-name>BPMN</ns8:mso-bpel-name>
385 </aetgt:MsoCompletionRequest>"""
387 payload = utils.formatXml(payload)
388 execution.setVariable("CVFMI_SuccessFlag", true)
389 execution.setVariable("CVFMI_msoCompletionRequest", payload)
390 msoLogger.debug("CreateVfModuleInfra completion request: " + payload)
391 msoLogger.debug("Outgoing MsoCompletionRequest: \n" + payload)
394 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", MsoLogger.getServiceName(),
395 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
396 execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
398 msoLogger.trace("COMPLETED PostProcessResponse Process")
406 * Validates the request, request id and service instance id. If a problem is found,
407 * a WorkflowException is generated and an MSOWorkflowException event is thrown. This
408 * method also sets up the log context for the workflow.
409 * @param execution the execution
410 * @return the validated request
412 public String validateInfraRequest(DelegateExecution execution) {
413 def method = getClass().getSimpleName() + '.validateInfraRequest(' +
414 'execution=' + execution.getId() +
417 msoLogger.trace('Started ' + method)
419 String processKey = getProcessKey(execution);
420 def prefix = execution.getVariable("prefix")
422 if (prefix == null) {
423 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")
427 def request = execution.getVariable(prefix + 'Request')
429 if (request == null) {
430 request = execution.getVariable(processKey + 'Request')
432 if (request == null) {
433 request = execution.getVariable('bpmnRequest')
436 setVariable(execution, processKey + 'Request', null);
437 setVariable(execution, 'bpmnRequest', null);
438 setVariable(execution, prefix + 'Request', request);
441 if (request == null) {
442 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
447 def requestId = execution.getVariable("mso-request-id")
449 if (requestId == null) {
450 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id")
453 setVariable(execution, prefix + 'requestId', requestId)
455 def serviceInstanceId = execution.getVariable("mso-service-instance-id")
457 if (serviceInstanceId == null) {
458 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id")
461 utils.logContext(requestId, serviceInstanceId)
463 msoLogger.debug("CreateVfModule incoming request: " + request)
464 msoLogger.debug('Incoming message: ' + System.lineSeparator() + request)
465 msoLogger.trace('Finished ' + method)
467 } catch (BpmnError e) {
469 } catch (Exception e) {
470 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
471 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
475 public void prepareUpdateInfraRequest(DelegateExecution execution){
476 msoLogger.trace("STARTED prepareUpdateInfraRequest Process")
479 String requestInfo = execution.getVariable("CVFMI_requestInfo")
480 def aicCloudRegion = execution.getVariable("CVFMI_lcpCloudRegionId")
481 def tenantId = execution.getVariable("CVFMI_tenantId")
482 def requestId = utils.getNodeText(requestInfo, "request-id")
483 def vnfId = execution.getVariable("CVFMI_vnfId")
484 def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
485 // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input
486 def vfModuleName = execution.getVariable("CVFMI_vfModuleName")
488 def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
489 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
490 msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
493 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
494 xmlns:ns="http://org.onap.so/requestsdb">
497 <ns:updateInfraRequest xmlns:ns="http://org.onap.so/requestsdb">
498 <requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
499 <lastModifiedBy>BPMN</lastModifiedBy>
500 <statusMessage>VF Module successfully created</statusMessage>
501 <responseBody></responseBody>
502 <requestStatus>COMPLETE</requestStatus>
503 <progress>100</progress>
504 <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>
505 <vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
506 <vfModuleName>${MsoUtils.xmlEscape(vfModuleName)}</vfModuleName>
507 </ns:updateInfraRequest>
509 </soapenv:Envelope>"""
511 payload = utils.formatXml(payload)
512 execution.setVariable("CVFMI_updateInfraRequest", payload)
513 msoLogger.debug("Outgoing UpdateInfraRequest: \n" + payload)
514 msoLogger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
517 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", MsoLogger.getServiceName(),
518 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
519 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
521 msoLogger.trace("COMPLETED prepareUpdateInfraRequest Process")
525 * Builds a "FalloutHandler" request and stores it in the specified execution variable.
527 * @param execution the execution
528 * @param resultVar the execution variable in which the result will be stored
530 public void falloutHandlerPrep(DelegateExecution execution, String resultVar) {
531 def method = getClass().getSimpleName() + '.falloutHandlerPrep(' +
532 'execution=' + execution.getId() +
533 ', resultVar=' + resultVar +
536 msoLogger.trace("Started " + method)
540 def WorkflowException workflowException = execution.getVariable("WorkflowException")
541 def requestInformation = execution.getVariable("CVFMI_requestInfo")
542 def errorResponseCode = workflowException.getErrorCode()
543 def errorResponseMsg = workflowException.getErrorMessage()
544 def encErrorResponseMsg = ""
545 if (errorResponseMsg != null) {
546 encErrorResponseMsg = errorResponseMsg
550 <aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
551 xmlns:reqtype="http://org.onap/so/request/types/v1"
552 xmlns:msoservtypes="http://org.onap/so/request/types/v1"
553 xmlns:structuredtypes="http://org.onap/so/structured/types/v1">
554 ${requestInformation}
555 <aetgt:WorkflowException>
556 <aetgt:ErrorMessage>${MsoUtils.xmlEscape(encErrorResponseMsg)}</aetgt:ErrorMessage>
557 <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorResponseCode)}</aetgt:ErrorCode>
558 </aetgt:WorkflowException>
559 </aetgt:FalloutHandlerRequest>
562 msoLogger.debug("CONTENT before translation: " + content)
563 content = utils.formatXml(content)
564 msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
565 msoLogger.debug("CreateVfModuleInfra FallOutHander Request: " + content)
566 execution.setVariable(resultVar, content)
568 msoLogger.trace('Exited ' + method)
569 } catch (BpmnError e) {
571 } catch (Exception e) {
572 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
573 exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
577 public void logAndSaveOriginalException(DelegateExecution execution) {
578 def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
579 'execution=' + execution.getId() +
581 msoLogger.trace('Entered ' + method)
583 logWorkflowException(execution, 'CreateVfModuleInfra caught an event')
584 saveWorkflowException(execution, 'CVFMI_originalWorkflowException')
587 public void validateRollbackResponse(DelegateExecution execution) {
588 def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
589 'execution=' + execution.getId() +
591 msoLogger.trace('Entered ' + method)
592 def originalException = execution.getVariable("CVFMI_originalWorkflowException")
593 execution.setVariable("WorkflowException", originalException)
595 execution.setVariable("RollbackCompleted", true)
599 public void sendErrorResponse(DelegateExecution execution){
600 msoLogger.trace("STARTED CreateVfModulenfra sendErrorResponse Process")
602 def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse")
603 if(sentSyncResponse == false){
604 WorkflowException wfex = execution.getVariable("WorkflowException")
605 String response = exceptionUtil.buildErrorResponseXml(wfex)
606 msoLogger.debug(response)
607 sendWorkflowResponse(execution, 500, response)
609 msoLogger.debug("Not Sending Error Response. Sync Response Already Sent")
612 } catch (Exception ex) {
613 msoLogger.debug("Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage())
614 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process")
616 msoLogger.trace("COMPLETED CreateVfModuleInfra sendErrorResponse Process")