SO catalogDB updates
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / onap / so / bpmn / common / scripts / ConfirmVolumeGroupTenant.groovy
index 9c6c5cd..fce9286 100644 (file)
@@ -25,14 +25,17 @@ package org.onap.so.bpmn.common.scripts
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.VolumeGroup
-import org.onap.so.client.aai.AAIObjectType
-import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.Relationships
-import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.Relationships
+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.onap.logging.filter.base.ErrorCode
 import org.onap.so.constants.Defaults
+import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -60,7 +63,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
                        String incomingGroupName = execution.getVariable("volumeGroupName")
                        String incomingTenantId = execution.getVariable("tenantId")
                        String aicCloudRegion = execution.getVariable("aicCloudRegion")
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
                        AAIResultWrapper wrapper = getAAIClient().get(uri);
                        Optional<VolumeGroup> volumeGroup = wrapper.asBean(VolumeGroup.class)
                        Optional<Relationships> relationships = wrapper.getRelationships()
@@ -68,9 +71,9 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
                                execution.setVariable("queryAAIVolumeGroupResponse", volumeGroup.get())
                                String volumeGroupTenantId = ""
                                if(relationships.isPresent()){
-                                       List<AAIResourceUri> tenantUris = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)
+                                       List<AAIResourceUri> tenantUris = relationships.get().getRelatedUris(Types.TENANT)
                                        for (AAIResourceUri tenantURI: tenantUris){
-                                                       volumeGroupTenantId = tenantURI.getURIKeys().get("tenant-id")
+                                                       volumeGroupTenantId = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId)
                                        }
                                }
                                //Determine if Tenant Ids match
@@ -105,9 +108,9 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
                }catch(BpmnError b){
                        throw b
                }catch(Exception e){
-                       logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", MsoLogger.getServiceName(),
-                                       MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
+                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                                       "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN",
+                                       ErrorCode.UnknownError.getValue(), e.getMessage());
                        exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.")
                }
                logger.trace("COMPLETED queryAAIForVolumeGroup Process ")
@@ -127,9 +130,9 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
                        logger.debug("Volume Heat Stack Id is: " + heatStackId)
 
                }catch(Exception e){
-               logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                               "Exception Occured Processing assignVolumeHeatId.", "BPMN", MsoLogger.getServiceName(),
-                               MsoLogger.ErrorCode.UnknownError.getValue(), e);
+               logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                               "Exception Occured Processing assignVolumeHeatId.", "BPMN",
+                               ErrorCode.UnknownError.getValue(), e);
                exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.")
        }
        logger.trace("COMPLETED assignVolumeHeatId Process ")
@@ -147,9 +150,9 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
 
                        exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
                }catch(Exception e){
-                       logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       "Exception Occured Processing assignWorkflowException.", "BPMN", MsoLogger.getServiceName(),
-                                       MsoLogger.ErrorCode.UnknownError.getValue(), e);
+                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                                       "Exception Occured Processing assignWorkflowException.", "BPMN",
+                                       ErrorCode.UnknownError.getValue(), e);
                }
                logger.trace("COMPLETED Assign Workflow Exception =")
        }