summaryrefslogtreecommitdiffstats
path: root/models-dao/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'models-dao/src/main/java')
-rw-r--r--models-dao/src/main/java/org/onap/policy/models/dao/PfDao.java8
-rw-r--r--models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java19
2 files changed, 14 insertions, 13 deletions
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/PfDao.java b/models-dao/src/main/java/org/onap/policy/models/dao/PfDao.java
index 6c862bb64..05f907fdd 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/PfDao.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/PfDao.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,8 +21,8 @@
package org.onap.policy.models.dao;
+import java.time.Instant;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import java.util.Map;
import org.onap.policy.models.base.PfConcept;
@@ -168,8 +168,8 @@ public interface PfDao {
* @param getRecordNum Total query count from database
* @return the objects that was retrieved from the database
*/
- <T extends PfConcept> List<T> getFiltered(Class<T> someClass, String name, String version, Date startTime,
- Date endTime, Map<String, Object> filterMap, String sortOrder, int getRecordNum);
+ <T extends PfConcept> List<T> getFiltered(Class<T> someClass, String name, String version, Instant startTime,
+ Instant endTime, Map<String, Object> filterMap, String sortOrder, int getRecordNum);
/**
* Get an object from the database, referred to by concept key.
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java b/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java
index 5e89ee591..c29c4bf2d 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,9 +21,10 @@
package org.onap.policy.models.dao.impl;
+import java.sql.Timestamp;
+import java.time.Instant;
import java.util.Collection;
import java.util.Collections;
-import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
@@ -355,7 +356,7 @@ public class DefaultPfDao implements PfDao {
@Override
public <T extends PfConcept> List<T> getFiltered(final Class<T> someClass, final String name, final String version,
- final Date startTime, final Date endTime, final Map<String, Object> filterMap, final String sortOrder,
+ final Instant startTime, final Instant endTime, final Map<String, Object> filterMap, final String sortOrder,
final int getRecordNum) {
final EntityManager mg = getEntityManager();
@@ -381,14 +382,14 @@ public class DefaultPfDao implements PfDao {
}
if (startTime != null) {
if (endTime != null) {
- query.setParameter("startTime", startTime);
- query.setParameter("endTime", endTime);
+ query.setParameter("startTime", Timestamp.from(startTime));
+ query.setParameter("endTime", Timestamp.from(endTime));
} else {
- query.setParameter("startTime", startTime);
+ query.setParameter("startTime", Timestamp.from(startTime));
}
} else {
if (endTime != null) {
- query.setParameter("endTime", endTime);
+ query.setParameter("endTime", Timestamp.from(endTime));
}
}
if (getRecordNum > 0) {
@@ -620,8 +621,8 @@ public class DefaultPfDao implements PfDao {
* endTime. null for ignore end time
* @return the filter string to query database
*/
- private String addKeyFilterString(String inputFilterString, final String name, final Date startTime,
- final Date endTime) {
+ private String addKeyFilterString(String inputFilterString, final String name, final Instant startTime,
+ final Instant endTime) {
String filterQueryString;
if (name != null) {
inputFilterString += NAME_FILTER + AND;