diff options
Diffstat (limited to 'vid-app-common/src/main/java/org')
3 files changed, 26 insertions, 20 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/PombaClientImpl.java b/vid-app-common/src/main/java/org/onap/vid/aai/PombaClientImpl.java index 000628d8a..15fda829c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/aai/PombaClientImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/aai/PombaClientImpl.java @@ -1,13 +1,13 @@ + package org.onap.vid.aai; import com.fasterxml.jackson.databind.ObjectMapper; +import javax.servlet.ServletContext; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.model.PombaInstance.PombaRequest; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.beans.factory.annotation.Autowired; -import javax.servlet.ServletContext; - public class PombaClientImpl implements PombaClientInterface { protected String fromAppId = "VidAaiController"; @@ -19,13 +19,14 @@ public class PombaClientImpl implements PombaClientInterface { @Autowired PombaRestInterface pombaRestInterface; + @Autowired + SystemPropertiesWrapper systemPropertiesWrapper; @Override public void verify(PombaRequest request) { String methodName = "doAaiPost"; logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start"); - String uri = SystemProperties.getProperty("pomba.server.url"); - + String uri = systemPropertiesWrapper.getProperty("pomba.server.url"); try { pombaRestInterface.RestPost(fromAppId, uri, new ObjectMapper().writeValueAsString(request)); diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java index 68d5b71d0..8fe7c1fa1 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java @@ -70,8 +70,9 @@ public class WebConfig { } @Bean - public AaiService getAaiService() { - return new AaiServiceImpl(); + public AaiService getAaiService(AaiClientInterface aaiClient, AaiOverTLSClientInterface aaiOverTLSClient, + AaiResponseTranslator aaiResponseTranslator, AAITreeNodeBuilder aaiTreeNode, AAIServiceTree aaiServiceTree) { + return new AaiServiceImpl(aaiClient, aaiOverTLSClient, aaiResponseTranslator, aaiTreeNode, aaiServiceTree); } @Bean diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java index fe4a66185..63da27828 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java @@ -63,23 +63,29 @@ public class AaiServiceImpl implements AaiService { private static final String CLOUD_REGION_NODE_TYPE = "cloud-region"; private int indexOfSubscriberName = 6; - @Autowired private AaiClientInterface aaiClient; - - @Autowired private AaiOverTLSClientInterface aaiOverTLSClient; - - @Autowired private AaiResponseTranslator aaiResponseTranslator; - - @Autowired private AAITreeNodeBuilder aaiTreeNode; - - @Autowired private AAIServiceTree aaiServiceTree; private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(AaiServiceImpl.class); + @Autowired + public AaiServiceImpl( + AaiClientInterface aaiClient, + AaiOverTLSClientInterface aaiOverTLSClient, + AaiResponseTranslator aaiResponseTranslator, + AAITreeNodeBuilder aaiTreeNode, + AAIServiceTree aaiServiceTree) + { + this.aaiClient = aaiClient; + this.aaiOverTLSClient = aaiOverTLSClient; + this.aaiResponseTranslator = aaiResponseTranslator; + this.aaiTreeNode = aaiTreeNode; + this.aaiServiceTree = aaiServiceTree; + } + private List<Service> convertModelToService(Model model) { List<Service> services = new ArrayList<>(); String category = ""; @@ -332,13 +338,11 @@ public class AaiServiceImpl implements AaiService { AaiResponse<GetTenantsResponse[]> aaiGetTenantsResponse = aaiClient.getTenants(globalCustomerId, serviceType); GetTenantsResponse[] tenants = aaiGetTenantsResponse.getT(); if (tenants != null) { - for (int i = 0; i < tenants.length; i++) { - tenants[i].isPermitted = roleValidator.isTenantPermitted(globalCustomerId, serviceType, tenants[i].tenantName); + for (GetTenantsResponse tenant : tenants) { + tenant.isPermitted = roleValidator.isTenantPermitted(globalCustomerId, serviceType, tenant.tenantName); } } return aaiGetTenantsResponse; - - } @Override |