summaryrefslogtreecommitdiffstats
path: root/models-provider/src/main/java
diff options
context:
space:
mode:
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>2021-02-16 16:25:18 +0000
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>2021-02-19 15:26:11 +0000
commit5a94ebda407e82a8df4abea1b8a916ea4f88d9cd (patch)
tree9372cfd5e716196ddd1bf908d4da5db7e64f93c0 /models-provider/src/main/java
parent7e4f9950ed004042e36e7e1f6f78224d62888e74 (diff)
Refactor timestamp property in policy models to use Instant
Updated JPA classes to use java.sql.TImestamp rather than Instant. Issue-ID: POLICY-3069 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: If5b874ec96931d4b8dd142d46a9980e83a4708fc
Diffstat (limited to 'models-provider/src/main/java')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java8
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java11
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java8
3 files changed, 14 insertions, 13 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java
index 3bf81adf7..3af069e24 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java
@@ -22,8 +22,8 @@
package org.onap.policy.models.provider;
+import java.time.Instant;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import lombok.NonNull;
import org.onap.policy.models.base.PfModelException;
@@ -324,7 +324,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the statistics found
* @throws PfModelException on errors getting statistics
*/
- public List<PdpStatistics> getPdpStatistics(final String name, final Date timestamp) throws PfModelException;
+ public List<PdpStatistics> getPdpStatistics(final String name, final Instant timestamp) throws PfModelException;
/**
@@ -341,7 +341,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @throws PfModelException on errors getting policies
*/
public List<PdpStatistics> getFilteredPdpStatistics(String name, @NonNull String pdpGroupName, String pdpSubGroup,
- Date startTimeStamp, Date endTimeStamp, String sortOrder, int getRecordNum) throws PfModelException;
+ Instant startTimeStamp, Instant endTimeStamp, String sortOrder, int getRecordNum) throws PfModelException;
/**
* Creates PDP statistics.
@@ -371,7 +371,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the PDP statistics deleted
* @throws PfModelException on errors deleting PDP statistics
*/
- public List<PdpStatistics> deletePdpStatistics(@NonNull String name, Date timestamp) throws PfModelException;
+ public List<PdpStatistics> deletePdpStatistics(@NonNull String name, Instant timestamp) throws PfModelException;
/**
* Gets all policy deployments.
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
index 8c7c5122b..1839604aa 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
@@ -22,8 +22,8 @@
package org.onap.policy.models.provider.impl;
+import java.time.Instant;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import javax.ws.rs.core.Response;
import lombok.NonNull;
@@ -247,15 +247,16 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
}
@Override
- public List<PdpStatistics> getPdpStatistics(final String name, final Date timestamp) throws PfModelException {
+ public List<PdpStatistics> getPdpStatistics(final String name, final Instant timestamp) throws PfModelException {
assertInitialized();
return new PdpStatisticsProvider().getPdpStatistics(getPfDao(), name, timestamp);
}
@Override
public List<PdpStatistics> getFilteredPdpStatistics(final String name, @NonNull final String pdpGroupName,
- final String pdpSubGroup, final Date startTimeStamp, final Date endTimeStamp, final String sortOrder,
- final int getRecordNum) throws PfModelException {
+ final String pdpSubGroup, final Instant startTimeStamp,
+ final Instant endTimeStamp, final String sortOrder,
+ final int getRecordNum) throws PfModelException {
assertInitialized();
return new PdpStatisticsProvider().getFilteredPdpStatistics(getPfDao(), name, pdpGroupName, pdpSubGroup,
startTimeStamp, endTimeStamp, sortOrder, getRecordNum);
@@ -276,7 +277,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
}
@Override
- public List<PdpStatistics> deletePdpStatistics(@NonNull final String name, final Date timestamp)
+ public List<PdpStatistics> deletePdpStatistics(@NonNull final String name, final Instant timestamp)
throws PfModelException {
assertInitialized();
return new PdpStatisticsProvider().deletePdpStatistics(getPfDao(), name, timestamp);
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
index 1b91f07c6..07617aad9 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
@@ -22,9 +22,9 @@
package org.onap.policy.models.provider.impl;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import javax.ws.rs.core.Response;
import lombok.NonNull;
@@ -211,13 +211,13 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public List<PdpStatistics> getPdpStatistics(final String name, final Date timestamp) throws PfModelException {
+ public List<PdpStatistics> getPdpStatistics(final String name, final Instant timestamp) throws PfModelException {
return new ArrayList<>();
}
@Override
public List<PdpStatistics> getFilteredPdpStatistics(String name, String pdpGroupName, String pdpSubGroup,
- Date startTimeStamp, Date endTimeStamp, String sortOrder, int getRecordNum) {
+ Instant startTimeStamp, Instant endTimeStamp, String sortOrder, int getRecordNum) {
// Not implemented
return new ArrayList<>();
}
@@ -237,7 +237,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public List<PdpStatistics> deletePdpStatistics(final String name, final Date timestamp) {
+ public List<PdpStatistics> deletePdpStatistics(final String name, final Instant timestamp) {
// Not implemented
return new ArrayList<>();
}