Add nssiId for AllocateTNNSSI request
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / groovy / org / onap / so / bpmn / infrastructure / scripts / DoCreateServiceInstance.groovy
index 163bd0f..94aca5f 100644 (file)
@@ -23,7 +23,6 @@
 package org.onap.so.bpmn.infrastructure.scripts;
 
 import static org.apache.commons.lang3.StringUtils.*;
-
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.OwningEntity
@@ -41,11 +40,12 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
 import org.onap.so.bpmn.core.domain.ServiceInstance
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
-import org.onap.so.client.aai.AAIObjectType
-import org.onap.so.client.aai.AAIResourcesClient
-import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -83,7 +83,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
        JsonUtils jsonUtil = new JsonUtils()
        CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
 
-       public void preProcessRequest (DelegateExecution execution) {
+       void preProcessRequest (DelegateExecution execution) {
                def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
                String msg = ""
                logger.trace("preProcessRequest")
@@ -286,14 +286,14 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                logger.trace("Exit preProcessRequest")
        }
 
-       public void getAAICustomerById (DelegateExecution execution) {
+       void getAAICustomerById (DelegateExecution execution) {
                // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId}
                try {
 
                        String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
                        logger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
 
-                       AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId))
                        if(!getAAIClient().exists(uri)){
                                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI")
                        }
@@ -306,7 +306,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
 
        }
 
-       public void putServiceInstance(DelegateExecution execution) {
+       void putServiceInstance(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                logger.trace("putServiceInstance")
                String msg = ""
@@ -354,7 +354,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        si.setWorkloadContext(workloadContext)
 
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(serviceInstanceId))
                        client.create(uri, si)
 
                } catch (BpmnError e) {
@@ -380,7 +380,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                logger.trace("Exit putServiceInstance")
        }
 
-       public void preProcessSDNCAssignRequest(DelegateExecution execution) {
+       void preProcessSDNCAssignRequest(DelegateExecution execution) {
                def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
                String msg = ""
                logger.trace("preProcessSDNCAssignRequest")
@@ -479,7 +479,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                logger.trace("Exit preProcessSDNCAssignRequest")
        }
 
-       public void postProcessSDNCAssign (DelegateExecution execution) {
+       void postProcessSDNCAssign (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                logger.trace("postProcessSDNCAssign")
                try {
@@ -491,7 +491,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        String response = execution.getVariable("sdncAdapterResponse")
                        logger.debug("SDNCResponse: " + response)
 
-                       SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
+                       SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
                        sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
 
                        if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
@@ -518,7 +518,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                logger.trace("Exit postProcessSDNCAssign")
        }
 
-       public void postProcessAAIGET2(DelegateExecution execution) {
+       void postProcessAAIGET2(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                logger.trace("postProcessAAIGET2")
                String msg = ""
@@ -561,7 +561,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                logger.trace("Exit postProcessAAIGET2")
        }
 
-       public void preProcessRollback (DelegateExecution execution) {
+       void preProcessRollback (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                logger.trace("preProcessRollback")
                try {
@@ -582,7 +582,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                logger.trace("Exit preProcessRollback")
        }
 
-       public void postProcessRollback (DelegateExecution execution) {
+       void postProcessRollback (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                logger.trace("postProcessRollback")
                String msg = ""
@@ -603,7 +603,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                logger.trace("Exit postProcessRollback")
        }
 
-       public void createProject(DelegateExecution execution) {
+       void createProject(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                logger.trace("createProject")
 
@@ -631,7 +631,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                logger.trace("Exit createProject")
        }
 
-       public void createOwningEntity(DelegateExecution execution) {
+       void createOwningEntity(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                logger.trace("createOwningEntity")
                String msg = "";
@@ -679,7 +679,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
        //     Build Error Section
        // *******************************
 
-       public void processJavaException(DelegateExecution execution){
+       void processJavaException(DelegateExecution execution){
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
 
                try{