diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2021-06-03 10:37:35 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2021-06-03 12:50:14 +0100 |
commit | d72a2ab96255ccc7a9c3a3506eab5509cbcf9ac9 (patch) | |
tree | ff63a01bc3ca1bf5c8430b98ed0437c3dafec246 /models-pap/src/main | |
parent | 443f9f35fe733fdb88b51ab9c574949f5dd4c03c (diff) |
Exposing the Audit provider through Models provider.
Change-Id: I4a3a28b6dbbfbad533a69cf46c545ece7e0b147e
Issue-ID: POLICY-2899
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'models-pap/src/main')
-rw-r--r-- | models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java b/models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java index c117beefa..8923fb23f 100644 --- a/models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java +++ b/models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java @@ -59,7 +59,7 @@ public class PolicyAuditProvider { BeanValidationResult result = new BeanValidationResult("createAuditRecords", jpaAudits); int count = 0; - for (JpaPolicyAudit jpaAudit: jpaAudits) { + for (JpaPolicyAudit jpaAudit : jpaAudits) { result.addResult(jpaAudit.validate(String.valueOf(count++))); } @@ -126,12 +126,22 @@ public class PolicyAuditProvider { */ @Data @Builder - protected static class AuditFilter { + public static class AuditFilter { private String name; private String version; private AuditAction action; private String pdpGroup; private Instant fromDate; private Instant toDate; + + /** + * Check if even still using build(), none of the params were provided. + * + * @return {@code true} if all empty/null; {@code false} otherwise. + */ + public boolean isEmpty() { + return StringUtils.isAllEmpty(name, version, pdpGroup) && action == null && fromDate == null + && toDate == null; + } } } |