diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-12-02 11:19:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-12-02 11:19:33 +0000 |
commit | 1baf7b36dd35b43f891654bf5eb2f62004fa77e9 (patch) | |
tree | f7c006916381551b47dc190ecd3bd9ada67b5617 /vid-app-common/src | |
parent | a2a7baa022b98919f4c008e29ba8a12b879e746c (diff) | |
parent | 48f350fa03ff2a0f65584575d4955a46ddf16898 (diff) |
Merge "Add query param option for filtering services info by service model id"
Diffstat (limited to 'vid-app-common/src')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java | 16 | ||||
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt | 4 |
2 files changed, 15 insertions, 5 deletions
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 5eb315d1a..c46266790 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 @@ -26,6 +26,7 @@ import java.util.List; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.vid.dal.AsyncInstantiationRepository; import org.onap.vid.exceptions.AccessDeniedException; import org.onap.vid.model.JobAuditStatus; import org.onap.vid.model.ServiceInfo; @@ -54,6 +55,7 @@ public class AsyncInstantiationController extends VidRestrictedBaseController { public static final String ASYNC_INSTANTIATION = "asyncInstantiation"; protected final AsyncInstantiationBusinessLogic asyncInstantiationBL; + protected final AsyncInstantiationRepository asyncInstantiationRepository; private final SystemPropertiesWrapper systemPropertiesWrapper; private final RoleProvider roleProvider; @@ -64,8 +66,11 @@ public class AsyncInstantiationController extends VidRestrictedBaseController { protected AuditService auditService; @Autowired - public AsyncInstantiationController(AsyncInstantiationBusinessLogic asyncInstantiationBL, RoleProvider roleProvider, FeatureManager featureManager, SystemPropertiesWrapper systemPropertiesWrapper) { + public AsyncInstantiationController(AsyncInstantiationBusinessLogic asyncInstantiationBL, + AsyncInstantiationRepository asyncInstantiationRepository, RoleProvider roleProvider, + FeatureManager featureManager, SystemPropertiesWrapper systemPropertiesWrapper) { this.asyncInstantiationBL = asyncInstantiationBL; + this.asyncInstantiationRepository = asyncInstantiationRepository; this.roleProvider = roleProvider; this.featureManager = featureManager; this.systemPropertiesWrapper = systemPropertiesWrapper; @@ -77,8 +82,13 @@ public class AsyncInstantiationController extends VidRestrictedBaseController { * @return the services list */ @RequestMapping(method = RequestMethod.GET) - public List<ServiceInfo> getServicesInfo(HttpServletRequest request) { - return asyncInstantiationBL.getAllServicesInfo(); + public List<ServiceInfo> getServicesInfo(HttpServletRequest request, + @RequestParam(value = "serviceModelId", required = false) UUID serviceModelId) { + if (serviceModelId == null) { + return asyncInstantiationBL.getAllServicesInfo(); + } else { + return asyncInstantiationRepository.listServicesByServiceModelId(serviceModelId); + } } @RequestMapping(value = "bulk", method = RequestMethod.POST) diff --git a/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt b/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt index 43d501656..c26b88a5e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt +++ b/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt @@ -154,6 +154,6 @@ class AsyncInstantiationRepository @Autowired constructor(val dataAccessService: return dataAccessService.getList(className, " WHERE $condition", orderBy, null) as List<T> } - fun listServicesByServiceModelId(modelUuid: UUID): List<ServiceInfo> = - dataAccessService.getList(ServiceInfo::class.java, filterByServiceModelId(modelUuid), orderByCreatedDateAndStatus(), null) as List<ServiceInfo>; + fun listServicesByServiceModelId(serviceModelId: UUID): List<ServiceInfo> = + dataAccessService.getList(ServiceInfo::class.java, filterByServiceModelId(serviceModelId), orderByCreatedDateAndStatus(), null) as List<ServiceInfo>; } |