summaryrefslogtreecommitdiffstats
path: root/models-provider/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-06-15 14:33:56 -0400
committerJim Hahn <jrh3@att.com>2021-06-15 16:32:37 -0400
commit27ac6bce15318a074d4fb53606571eb30e46bf07 (patch)
tree54b32ac79e62049b50f1439a3c756a287606b5f2 /models-provider/src/main
parentbb744354e343ca05a0b5921ddb60b4cd2a134ccc (diff)
Replace method parameters with filter parameters
Added more methods taking filter parameters instead of individual method parameters. Removed the old methods. Added genOrderClause(). Issue-ID: POLICY-3094 Change-Id: Ie9d8c13a8d4a7f81e284f07fce3d96a35918a114 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-provider/src/main')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java15
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java17
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java6
3 files changed, 12 insertions, 26 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 5321e8597..8782a6928 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
@@ -35,6 +35,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
+import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
@@ -332,18 +333,11 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Get filtered PdpStatistics.
*
- * @param name the pdpInstance name for the PDP statistics to get
- * @param pdpGroupName pdpGroupName to filter statistics
- * @param pdpSubGroup pdpSubGroupType name to filter statistics
- * @param startTimeStamp startTimeStamp to filter statistics
- * @param endTimeStamp endTimeStamp to filter statistics
- * @param sortOrder sortOrder to query database
- * @param getRecordNum Total query count from database
+ * @param filterParams filter parameters
* @return the PDP statistics found
* @throws PfModelException on errors getting policies
*/
- public List<PdpStatistics> getFilteredPdpStatistics(String name, @NonNull String pdpGroupName, String pdpSubGroup,
- Instant startTimeStamp, Instant endTimeStamp, String sortOrder, int getRecordNum) throws PfModelException;
+ public List<PdpStatistics> getFilteredPdpStatistics(PdpFilterParameters filterParams) throws PfModelException;
/**
* Creates PDP statistics.
@@ -421,8 +415,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Collect the audit records.
* @param auditFilter filter for search
- * @param numRecords max number of records to be collected
* @return list of {@link PolicyAudit} or empty if none or not match with filter
*/
- public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter, @NonNull Integer numRecords);
+ public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter);
}
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 3bba1518a..95300e62d 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
@@ -38,6 +38,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
+import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters;
import org.onap.policy.models.pdp.persistence.provider.PdpProvider;
import org.onap.policy.models.pdp.persistence.provider.PdpStatisticsProvider;
import org.onap.policy.models.provider.PolicyModelsProvider;
@@ -256,13 +257,9 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
}
@Override
- public List<PdpStatistics> getFilteredPdpStatistics(final String name, @NonNull final String pdpGroupName,
- final String pdpSubGroup, final Instant startTimeStamp,
- final Instant endTimeStamp, final String sortOrder,
- final int getRecordNum) throws PfModelException {
+ public List<PdpStatistics> getFilteredPdpStatistics(PdpFilterParameters filterParams) throws PfModelException {
assertInitialized();
- return new PdpStatisticsProvider().getFilteredPdpStatistics(getPfDao(), name, pdpGroupName, pdpSubGroup,
- startTimeStamp, endTimeStamp, sortOrder, getRecordNum);
+ return new PdpStatisticsProvider().getFilteredPdpStatistics(getPfDao(), filterParams);
}
@Override
@@ -319,13 +316,9 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
}
@Override
- public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter, @NonNull Integer numRecords) {
+ public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter) {
assertInitialized();
- if (auditFilter == null || auditFilter.isEmpty()) {
- return new PolicyAuditProvider().getAuditRecords(getPfDao(), numRecords);
- } else {
- return new PolicyAuditProvider().getAuditRecords(getPfDao(), auditFilter, numRecords);
- }
+ return new PolicyAuditProvider().getAuditRecords(getPfDao(), auditFilter);
}
/**
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 dbeccfaeb..e705ae3ed 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
@@ -40,6 +40,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
+import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
@@ -218,8 +219,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public List<PdpStatistics> getFilteredPdpStatistics(String name, String pdpGroupName, String pdpSubGroup,
- Instant startTimeStamp, Instant endTimeStamp, String sortOrder, int getRecordNum) {
+ public List<PdpStatistics> getFilteredPdpStatistics(PdpFilterParameters filterParams) throws PfModelException {
// Not implemented
return new ArrayList<>();
}
@@ -275,7 +275,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter, @NonNull Integer numRecords) {
+ public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter) {
// Not implemented
return new ArrayList<>();
}