diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-12-05 03:58:34 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-05 03:58:34 +0000 |
commit | 12b82667b31640f815a973dc0762f78254165a52 (patch) | |
tree | e9c7a890a58ef649432068675efd69a545c9ad4e /adapters/mso-catalog-db-adapter/src/main | |
parent | 0f8c365d5585875e7647e5863ea92dc5737e63b7 (diff) | |
parent | 00252f954034db74056a1d1cf28adb0cc2c8fa34 (diff) |
Merge "Fix auth for catalog db"
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.java | 15 |
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")); } |