From 89de17b50dcd1d29fb87acfe518d1ddf43c1408a Mon Sep 17 00:00:00 2001 From: Yoav Schneiderman Date: Wed, 18 Dec 2019 21:04:38 +0200 Subject: move templates API to a intended controller Issue-ID: VID-730 Change-Id: Id2aa44803a190333b5a96fda77ca15d254b4c222 Signed-off-by: Einat Vinouze --- .../onap/vid/controller/AsyncInstantiationController.java | 15 +++------------ .../vid/controller/InstantiationTemplatesController.java | 11 +++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap') diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java index 3260656ff..6c8a37262 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java @@ -76,20 +76,11 @@ public class AsyncInstantiationController extends VidRestrictedBaseController { this.auditService = auditService; } - /** - * Gets the new services status. - * @param request the request - * @return the services list - */ @RequestMapping(method = RequestMethod.GET) - public List getServicesInfo(HttpServletRequest request, - @RequestParam(value = "serviceModelId", required = false) UUID serviceModelId) { - if (serviceModelId == null) { - return asyncInstantiationBL.getAllServicesInfo(); - } else { - return asyncInstantiationRepository.listInstantiatedServicesByServiceModelId(serviceModelId); - } + public List getServicesInfo(HttpServletRequest request) { + return asyncInstantiationBL.getAllServicesInfo(); } + @RequestMapping(value = "bulk", method = RequestMethod.POST) public MsoResponseWrapper2> createBulkOfServices(@RequestBody ServiceInstantiation request, HttpServletRequest httpServletRequest) { //Push to DB according the model diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/InstantiationTemplatesController.java b/vid-app-common/src/main/java/org/onap/vid/controller/InstantiationTemplatesController.java index 8aae3d805..ff9add2b6 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/InstantiationTemplatesController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/InstantiationTemplatesController.java @@ -21,9 +21,11 @@ package org.onap.vid.controller; +import java.util.List; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import org.onap.vid.dal.AsyncInstantiationRepository; +import org.onap.vid.model.ServiceInfo; import org.onap.vid.model.serviceInstantiation.ServiceInstantiation; import org.onap.vid.services.AsyncInstantiationBusinessLogic; import org.onap.vid.services.InstantiationTemplatesService; @@ -31,6 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController @@ -53,6 +57,13 @@ public class InstantiationTemplatesController extends VidRestrictedBaseControlle this.asyncInstantiationRepository = asyncInstantiationRepository; } + + @GetMapping + public List getTemplatesInfo(HttpServletRequest request, + @RequestParam(value = "serviceModelId") UUID serviceModelId) { + return asyncInstantiationRepository.listInstantiatedServicesByServiceModelId(serviceModelId); + } + @GetMapping("templateTopology/{jobId}") public ServiceInstantiation getTemplateTopology(HttpServletRequest request, @PathVariable(value="jobId") UUID jobId) { return instantiationTemplates.getJobRequestAsTemplate(jobId); -- cgit 1.2.3-korg