[MSO-8] Update the maven dependency
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / groovy / org / openecomp / mso / bpmn / infrastructure / scripts / DeleteVfModuleVolumeInfraV1.groovy
  * ============LICENSE_END=========================================================
  */
 
-package com.att.bpm.scripts;
+package org.openecomp.mso.bpmn.infrastructure.scripts;
 
 import groovy.json.JsonSlurper
+
 import java.util.concurrent.ExecutionException;
-import org.springframework.web.util.UriUtils
 
+import org.springframework.web.util.UriUtils
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.runtime.Execution
 import org.apache.commons.lang3.*
-
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil;
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+import org.openecomp.mso.bpmn.common.scripts.VidUtils;
 import org.openecomp.mso.bpmn.core.WorkflowException
 import org.openecomp.mso.rest.APIResponse
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
 
 /**
  * This groovy class supports the <class>DeleteVfModuleVolume.bpmn</class> process.
@@ -112,7 +114,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
 
                def requestInfo = getRequiredNodeXml(execution, request, 'request-info')
                execution.setVariable('DELVfModVol_requestInfo', requestInfo)
-               String requestId = execution.getVariable("att-mso-request-id")
+               String requestId = execution.getVariable("mso-request-id")
                if (requestId == null || requestId == "") {
                        requestId = getRequiredNodeText(execution, requestInfo, 'request-id')
                }
@@ -130,6 +132,19 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
                execution.setVariable('DELVfModVol_volumeParams', utils.getNodeXml(request, 'volume-params'))
                execution.setVariable('DELVfModVol_cloudRegion', utils.getNodeText1(request, 'aic-cloud-region'))
 
+               try {
+                       // Catalog DB headers Authorization
+                       String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
+                       utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
+                       
+                       def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey"))
+                       execution.setVariable("BasicAuthHeaderValueDB",encodedString)
+               } catch (IOException ex) {
+                       String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
+                       utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
+               }
+               
                logDebug('Request: ' + createVolumeIncoming, isDebugLogEnabled)
        }
 
@@ -348,7 +363,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
                def serviceId = execution.getVariable('DELVfModVol_serviceId')
 
                def messageId = execution.getVariable('DELVfModVol_messageId')
-               def notificationUrl = execution.getVariable("URN_mso_workflow_vnfadapter_rest_callback")
+               def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) 
                def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host")
                if ('true'.equals(useQualifiedHostName)) {
                                notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
@@ -438,7 +453,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
 
                String updateInfraRequest = """
                        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
-                                       xmlns:req="http://com.att.mso/requestsdb">
+                                       xmlns:req="http://org.openecomp.mso/requestsdb">
                                <soapenv:Header/>
                                <soapenv:Body>
                                        <req:updateInfraRequest>
@@ -461,13 +476,13 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
 
 
        public void prepareCompletionHandlerRequest (Execution execution, isDebugLogEnabled) {
-               def requestId = execution.getVariable("att-mso-request-id")
+               def requestId = execution.getVariable("mso-request-id")
                def source = execution.getVariable("DELVfModVol_source")
 
                String msoCompletionRequest =
-                       """<aetgt:MsoCompletionRequest xmlns:aetgt="http://ecomp.att.com/mso/workflow/schema/v1"
-                                                       xmlns:ns="http://ecomp.att.com/mso/request/types/v1">
-                                       <request-info xmlns="http://ecomp.att.com/mso/infra/vnf-request/v1">
+                       """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+                                                       xmlns:ns="http://org.openecomp/mso/request/types/v1">
+                                       <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
                                                <request-id>${requestId}</request-id>
                                                <action>DELETE</action>
                                                <source>${source}</source>
@@ -495,10 +510,10 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
                def errorCode =  workflowExceptionObj.getErrorCode()
 
                String falloutHandlerRequest =
-                   """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://ecomp.att.com/mso/workflow/schema/v1"
-                                                            xmlns:ns="http://ecomp.att.com/mso/request/types/v1"
-                                                            xmlns:wfsch="http://ecomp.att.com/mso/workflow/schema/v1">
-                                  <request-info xmlns="http://ecomp.att.com/mso/infra/vnf-request/v1">
+                   """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+                                                            xmlns:ns="http://org.openecomp/mso/request/types/v1"
+                                                            xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1">
+                                  <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
                                      <request-id>${requestId}</request-id>
                                      <action>DELETE</action>
                                      <source>${source}</source>