aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-11-15 15:21:25 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-15 15:21:25 +0000
commit1c47acb0e6f8b9624fd8e71ed09491f57dd1a3e0 (patch)
tree2677621a0b4cb37ed40ec79c93d9d10ea7c6dcf7 /adapters
parentcc4ce80333d6258d4755f812c7933519af61476b (diff)
parent70c584bb6b6bb1bb1406c327bb8910e867bc0cab (diff)
Merge "Fix auth for catalog db" into casablanca
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index 36e00ad599..8a7b7a2e9d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -520,13 +520,21 @@ public class CatalogDbAdapterRest {
try {
if (smUuid != null && !"".equals(smUuid)) {
logger.debug("Query Csar by service model uuid: {}",smUuid);
- ToscaCsar toscaCsar = toscaCsarRepo.findOne(smUuid);
- if (toscaCsar != null) {
- QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar);
- entity = serviceCsar.JSON2(false, false);
+
+ Service service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(smUuid);
+
+ if (service != null) {
+ ToscaCsar toscaCsar = service.getCsar();
+ if (toscaCsar != null) {
+ QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar);
+ entity = serviceCsar.JSON2(false, false);
+ } else {
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ }
} else {
respStatus = HttpStatus.SC_NOT_FOUND;
}
+
} else {
throw (new Exception("Incoming parameter is null or blank"));
}