aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db-repositories/src/main
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-03-10 14:54:05 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-10 14:54:05 +0000
commit4dc7f5c75956c68223003ad10670ef47bdad6e26 (patch)
tree81bee1d8b7a0672bc9f8eed63941fffde9ccaaf2 /mso-api-handlers/mso-requests-db-repositories/src/main
parentb6e82755d6b3454951d3627dd3f51a0e2a50f49b (diff)
parentf098f1a57f024df9396ec994129f0a01b7a94248 (diff)
Merge "Enable date span filtering for getOrchestrationFiltersFromInfraActive"
Diffstat (limited to 'mso-api-handlers/mso-requests-db-repositories/src/main')
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index da8f30ab1e..b669b7d837 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -277,17 +277,22 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
mapKey = "startTime";
}
+ final String operator = entry.getValue().get(0);
final String propertyValue = entry.getValue().get(1);
if ("startTime".equals(mapKey)) {
final SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
try {
final Date thisDate = format.parse(propertyValue);
final Timestamp minTime = new Timestamp(thisDate.getTime());
- final Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
+ Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
- if ("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
+ if ("DOES_NOT_EQUAL".equalsIgnoreCase(operator)) {
predicates.add(cb.or(cb.lessThan(tableRoot.get(mapKey), minTime),
cb.greaterThanOrEqualTo(tableRoot.get(mapKey), maxTime)));
+ } else if ("BETWEEN_DATES".equalsIgnoreCase(operator)) {
+ Date endDate = format.parse(entry.getValue().get(2));
+ maxTime = new Timestamp(endDate.getTime());
+ predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime));
} else {
predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime));
}
@@ -295,7 +300,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
logger.debug("Exception in getOrchestrationFiltersFromInfraActive(): {}", e.getMessage(), e);
return null;
}
- } else if ("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
+ } else if ("DOES_NOT_EQUAL".equalsIgnoreCase(operator)) {
predicates.add(cb.notEqual(tableRoot.get(mapKey), propertyValue));
} else {
predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue));