diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-11-15 17:35:55 +0530 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-11-15 17:35:55 +0530 |
commit | 70c584bb6b6bb1bb1406c327bb8910e867bc0cab (patch) | |
tree | 40af582de3c60a46dab2cec3e5176c47d3dd3ac0 /adapters/mso-catalog-db-adapter/src/main | |
parent | 0578fc4948e8e98e5fe92e63832336f0b7e17e85 (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.java | 16 |
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")); } |