aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-10-24 14:42:15 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-10-24 14:42:16 -0400
commitfd9cba6af0486e479ae5e953e880ae99aa3f2432 (patch)
treeec678706f78886324827f844c7dcb28aa0b6e8fa /mso-api-handlers
parent86f62530f1813152efbcc3d61f85e1fa6c943e36 (diff)
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) <mb388a@att.com> Change-Id: Idd4c077a13c15dd6c22ef168d164f2df2aed4cff
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java5
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java11
2 files changed, 16 insertions, 0 deletions
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<InfraActiveRequests> findByEndTimeLessThan(Date endTime, Pageable request);
List<InfraActiveRequests> 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<InfraActiveRequests> getInProgressVolumeGroupsAndVfModules();
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 99c1d1ea72..ef946bfcc8 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -115,6 +115,8 @@ public class RequestsDbClient {
private String getInfraActiveRequests = "/infraActiveRequests/v1/getInfraActiveRequests";
+ private String getInProgressVolumeGroupsAndVfModules = "/infraActiveRequests/getInProgressVolumeGroupsAndVfModules";
+
private static final String findBySoRequestIdAndGroupIdAndName =
"/requestProcessingData/search/findOneBySoRequestIdAndGroupingIdAndName";
@@ -185,6 +187,15 @@ public class RequestsDbClient {
}
}
+ public List<InfraActiveRequests> getInProgressVolumeGroupsAndVfModules() {
+ HttpHeaders headers = getHttpHeaders();
+ URI uri = getUri(endpoint + getInProgressVolumeGroupsAndVfModules);
+ HttpEntity<Map<String, List<String>>> entity = new HttpEntity<>(headers);
+ return restTemplate
+ .exchange(uri, HttpMethod.GET, entity, new ParameterizedTypeReference<List<InfraActiveRequests>>() {})
+ .getBody();
+ }
+
public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) {
try {
HttpEntity<?> entity = getHttpEntity();