summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2020-01-08 16:23:27 +0200
committerAlexey Sandler <alexey.sandler@intl.att.com>2020-01-08 17:13:47 +0200
commit34196e69786be3485c5a6afdcfb41bdf548abb4b (patch)
tree7588586e4d16f117578a7be625ea6256f5432d8c /vid-app-common/src/main
parent0d51682c8db4e9309732e5a773ba45dac66fe5fd (diff)
VidController sets isInstantiationTemplateExists on Browse SDC
Issue-ID: VID-739 Change-Id: I8dea890c8518e3c314e5371eaa982ce7550b27a5 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/VidController.java16
1 files changed, 14 insertions, 2 deletions
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<Role> roles = roleProvider.getUserRoles(request);
- secureServices.setServices(aaiService.getServicesByDistributionStatus());
+
+ Collection<Service> servicesByDistributionStatus = aaiService.getServicesByDistributionStatus();
+
+ Collection<Service> servicesWithTemplatesIndication =
+ instantiationTemplatesService.setOnEachServiceIsTemplateExists(servicesByDistributionStatus);
+
+ secureServices.setServices(servicesWithTemplatesIndication);
secureServices.setReadOnly(roleProvider.userPermissionIsReadOnly(roles));
+
return secureServices;
}