From 00252f954034db74056a1d1cf28adb0cc2c8fa34 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Thu, 15 Nov 2018 17:35:55 +0530 Subject: Fix auth for catalog db Fix auth for catalog db. Change-Id: Ic787993f608b7ddf74167f7859a519ca02b794ed Issue-ID: SO-689 Signed-off-by: subhash kumar singh --- .../so/adapters/catalogdb/rest/CatalogDbAdapterRest.java | 15 +++++++++++---- .../resources/subprocess/DoDeleteE2EServiceInstance.bpmn | 6 +++--- common/src/main/java/org/onap/so/client/HttpClient.java | 1 - 3 files changed, 14 insertions(+), 8 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")); } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 17f6c66e4a..6084f570ce 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -189,7 +189,7 @@ dcsi.postDecomposeService(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + ${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)} ${CVFMI_updateServiceOperStatusRequest} @@ -206,12 +206,12 @@ dcsi.postDecomposeService(execution)]]> SequenceFlow_0h5c1bd SequenceFlow_1ab3vex - import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("result", "finished") execution.setVariable("operationContent", "No actual resoure in service instance") def csi= new DoDeleteE2EServiceInstance() -csi.prepareUpdateServiceOperationStatus(execution)]]> +csi.prepareUpdateServiceOperationStatus(execution) SequenceFlow_0h5c1bd diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java index 12f19ac607..66e970a154 100644 --- a/common/src/main/java/org/onap/so/client/HttpClient.java +++ b/common/src/main/java/org/onap/so/client/HttpClient.java @@ -47,7 +47,6 @@ public class HttpClient extends RestClient { @Override protected void initializeHeaderMap(Map headerMap) { - } @Override -- cgit 1.2.3-korg