aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/nbi/apis/serviceinventory
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/nbi/apis/serviceinventory')
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java12
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java15
2 files changed, 13 insertions, 14 deletions
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
index 391cf41..ebb5144 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
@@ -57,7 +57,7 @@ public class AaiClient extends BaseClient {
@PostConstruct
private void setUpAndlogAAIUrl() {
- aaiServiceUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE_FOR_CUSTOMER_PATH).toString();
+ aaiServiceUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE).toString();
aaiServicesUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH).toString();
aaiServicesInstancesUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE_INSTANCES_PATH).toString();
@@ -94,7 +94,17 @@ public class AaiClient extends BaseClient {
}
return null;
}
+
+ public Map getService(String serviceId) {
+ String callUrlFormated = aaiServiceUrl.replace("$serviceId", serviceId);
+
+ ResponseEntity<Object> response = callApiGet(callUrlFormated, buildRequestHeaderForAAI());
+ if (response != null && response.getStatusCode().equals(HttpStatus.OK)) {
+ return (LinkedHashMap) response.getBody();
+ }
+ return null;
+ }
public Map getVNF(String relatedLink) {
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
index 1564e9c..57bb0f9 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
@@ -48,24 +48,13 @@ public class ServiceInventoryService {
public Map get(String serviceId, MultiValueMap<String, String> params) {
- String clientId = params.getFirst("relatedParty.id");
- String serviceSpecId = params.getFirst("serviceSpecification.id");
- String serviceSpecName = params.getFirst("serviceSpecification.name");
-
- if (StringUtils.isEmpty(serviceSpecId) && StringUtils.isEmpty(serviceSpecName)) {
- throw new BackendFunctionalException(HttpStatus.NOT_FOUND,
- "serviceSpecName or serviceSpecId must be provided","serviceSpecName or serviceSpecId must be provided");
- }
-
- String customerId = getCustomerId(clientId);
- String serviceName = getServiceName(serviceSpecName, serviceSpecId);
- Map serviceResponse = aaiClient.getCatalogService(customerId, serviceName, serviceId);
+
+ Map serviceResponse = aaiClient.getService(serviceId);
if (serviceResponse != null) {
addVnfsToResponse(serviceResponse);
LinkedHashMap serviceInventoryResponse =
(LinkedHashMap) getServiceInventoryJsonTransformer.transform(serviceResponse);
- addRelatedPartyId(customerId, serviceInventoryResponse);
return serviceInventoryResponse;
} else {
throw new BackendFunctionalException(HttpStatus.NOT_FOUND, "no catalog service found","no catalog service found");