summaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-06-15 16:18:55 -0400
committerJim Hahn <jrh3@att.com>2021-06-15 16:19:58 -0400
commit9c156a523a1283a67a6b8e23be90742b0f87ed23 (patch)
tree3eb47eae2e90ac72b1a2af47eb39785f8b11daae /main/src
parent96545dee212569ea6bca1dc9a0de2f0d7a458e2a (diff)
Use new filtering methods in PAP
Modified PAP to use the new filter parameters classes instead of the old methods that take lots of parameters. Issue-ID: POLICY-3094 Change-Id: I46ac6d95a8f1e56ced8ed39474eb5a1031142dd7 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java8
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java4
2 files changed, 8 insertions, 4 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java
index 27e3d7ac..93632659 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java
@@ -31,6 +31,7 @@ import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
+import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.pap.main.PapConstants;
import org.onap.policy.pap.main.PolicyModelsProviderFactoryWrapper;
@@ -46,7 +47,6 @@ import org.slf4j.LoggerFactory;
public class StatisticsRestProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(StatisticsRestProvider.class);
private static final String GET_STATISTICS_ERR_MSG = "fetch database failed";
- private static final String DESC_ORDER = "DESC";
/**
* Returns the current statistics of pap component.
@@ -92,8 +92,10 @@ public class StatisticsRestProvider {
if (groupName == null) {
pdpStatisticsMap = generatePdpStatistics(databaseProvider.getPdpStatistics(pdpName, startTime));
} else {
- pdpStatisticsMap = generatePdpStatistics(databaseProvider.getFilteredPdpStatistics(pdpName, groupName,
- subType, startTime, endTime, DESC_ORDER, recordCount));
+ pdpStatisticsMap = generatePdpStatistics(databaseProvider.getFilteredPdpStatistics(
+ PdpFilterParameters.builder().name(pdpName).group(groupName)
+ .subGroup(subType).startTime(startTime).endTime(endTime)
+ .recordNum(recordCount).build()));
}
} catch (final PfModelException exp) {
String errorMessage = GET_STATISTICS_ERR_MSG + "groupName:" + groupName + "subType:" + subType + "pdpName:"
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java
index 1ecea074..0f668bef 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java
@@ -39,6 +39,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroup;
import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
+import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.pap.main.PolicyModelsProviderFactoryWrapper;
@@ -182,7 +183,8 @@ public class End2EndBase extends CommonPapRestServer {
*/
public static List<PdpStatistics> fetchPdpStatistics(final String instanceId, final String groupName,
final String subGroupName) throws PfModelException {
- return dbConn.getFilteredPdpStatistics(instanceId, groupName, subGroupName, null, null, null, 0);
+ return dbConn.getFilteredPdpStatistics(
+ PdpFilterParameters.builder().name(instanceId).group(groupName).subGroup(subGroupName).build());
}
/**