aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/main
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-11-15 17:35:55 +0530
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-12-04 17:39:10 +0530
commit00252f954034db74056a1d1cf28adb0cc2c8fa34 (patch)
tree8ed66b09971de44ee10632ed322c2bd71d161074 /adapters/mso-catalog-db-adapter/src/main
parent9a3841eadc588c3b3f50f2351b741edd139ca13c (diff)
Fix auth for catalog db
Fix auth for catalog db. Change-Id: Ic787993f608b7ddf74167f7859a519ca02b794ed Issue-ID: SO-689 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java15
1 files changed, 11 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 2fc1c3d70a..8c323af71b 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,20 @@ public class CatalogDbAdapterRest {
try {
if (smUuid != null && !"".equals(smUuid)) {
logger.debug("Query Csar by service model uuid: {}",smUuid);
- ToscaCsar toscaCsar = toscaCsarRepo.findById(smUuid).orElseGet(() -> null);
- 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"));
}