From fd9cba6af0486e479ae5e953e880ae99aa3f2432 Mon Sep 17 00:00:00 2001 From: "Plummer, Brittany" Date: Thu, 24 Oct 2019 14:42:15 -0400 Subject: add new query for requestdb Updated RequestDbClient to call new request mapping to query for IN_PROGRESS volumeGroup and vfModule requests older than two minutes. Issue-ID: SO-2490 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Idd4c077a13c15dd6c22ef168d164f2df2aed4cff --- .../so/db/request/data/repository/InfraActiveRequestsRepository.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mso-api-handlers/mso-requests-db-repositories/src/main/java') diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java index a14699827d..e2c7aef4f4 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java @@ -25,6 +25,7 @@ import java.util.List; import org.onap.so.db.request.beans.InfraActiveRequests; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @@ -47,4 +48,8 @@ public interface InfraActiveRequestsRepository List findByEndTimeLessThan(Date endTime, Pageable request); List findByStartTimeLessThanAndEndTime(Date startTime, Date endTime, Pageable request); + + @Query(value = "SELECT * FROM infra_active_requests WHERE request_status = 'IN_PROGRESS' AND (request_scope = 'volumeGroup' OR request_scope = 'vfModule') AND start_time < (NOW() - INTERVAL 2 MINUTE)", + nativeQuery = true) + List getInProgressVolumeGroupsAndVfModules(); } -- cgit 1.2.3-korg