From 34196e69786be3485c5a6afdcfb41bdf548abb4b Mon Sep 17 00:00:00 2001 From: Alexey Sandler Date: Wed, 8 Jan 2020 16:23:27 +0200 Subject: VidController sets isInstantiationTemplateExists on Browse SDC Issue-ID: VID-739 Change-Id: I8dea890c8518e3c314e5371eaa982ce7550b27a5 Signed-off-by: Alexey Sandler --- .../main/java/org/onap/vid/controller/VidController.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'vid-app-common/src/main') diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/VidController.java b/vid-app-common/src/main/java/org/onap/vid/controller/VidController.java index 15bc5ed7c..d257000bf 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/VidController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/VidController.java @@ -21,16 +21,19 @@ package org.onap.vid.controller; +import java.util.Collection; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.vid.asdc.AsdcCatalogException; import org.onap.vid.asdc.beans.SecureServices; +import org.onap.vid.asdc.beans.Service; import org.onap.vid.exceptions.VidServiceUnavailableException; import org.onap.vid.model.PombaInstance.PombaRequest; import org.onap.vid.model.ServiceModel; import org.onap.vid.roles.Role; import org.onap.vid.roles.RoleProvider; import org.onap.vid.services.AaiService; +import org.onap.vid.services.InstantiationTemplatesService; import org.onap.vid.services.PombaService; import org.onap.vid.services.VidService; import org.springframework.beans.factory.annotation.Autowired; @@ -50,14 +53,16 @@ public class VidController extends RestrictedBaseController { private final AaiService aaiService; private final RoleProvider roleProvider; private final PombaService pombaService; + private final InstantiationTemplatesService instantiationTemplatesService; @Autowired public VidController(VidService vidService, AaiService aaiService, RoleProvider roleProvider, - PombaService pombaService) { + PombaService pombaService, InstantiationTemplatesService instantiationTemplatesService) { this.vidService = vidService; this.aaiService = aaiService; this.roleProvider = roleProvider; this.pombaService = pombaService; + this.instantiationTemplatesService = instantiationTemplatesService; } /** @@ -69,8 +74,15 @@ public class VidController extends RestrictedBaseController { LOG.info("Start API for browse SDC was called"); SecureServices secureServices = new SecureServices(); List roles = roleProvider.getUserRoles(request); - secureServices.setServices(aaiService.getServicesByDistributionStatus()); + + Collection servicesByDistributionStatus = aaiService.getServicesByDistributionStatus(); + + Collection servicesWithTemplatesIndication = + instantiationTemplatesService.setOnEachServiceIsTemplateExists(servicesByDistributionStatus); + + secureServices.setServices(servicesWithTemplatesIndication); secureServices.setReadOnly(roleProvider.userPermissionIsReadOnly(roles)); + return secureServices; } -- cgit 1.2.3-korg