diff options
author | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2021-03-09 12:49:39 +0000 |
---|---|---|
committer | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2021-03-09 12:49:39 +0000 |
commit | ed19ece1be53159e265a0e400e2618ef0bd8721a (patch) | |
tree | 30ddc866bdc8f9c6bd6df1ac2427c4c20fa05f1d | |
parent | 1c3fb9a68d8d27c4bdc3e177550a031b8b3ec5b0 (diff) |
Add support for localName based filtering in PfReferenceTimestamp key.
Issue : Currently we have a requirement to filter control loop
statistics based on the UUID of the element which is "localName" of the
PfREferenceTimestamp key. Adding UUID as part of filterMap in
getFiltered() method which also requires this minor change in buildFilter.
Issue-ID: POLICY-3051
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: Idb9f4fc47c439f84bf8fc784bd9e228a2e05d8e9
-rw-r--r-- | models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java | 11 |
1 files changed, 8 insertions, 3 deletions
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 ef86c177b..bdbc04e22 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 @@ -367,7 +367,7 @@ public class DefaultPfDao implements PfDao { try { if (filterMap != null) { - filterQueryString = buildFilter(filterMap, filterQueryString); + filterQueryString = buildFilter(filterMap, filterQueryString, isRefTimestampKey(someClass)); } filterQueryString = addKeyFilterString(filterQueryString, name, startTime, endTime, isRefTimestampKey(someClass)); @@ -425,10 +425,15 @@ public class DefaultPfDao implements PfDao { } } - private String buildFilter(final Map<String, Object> filterMap, String filterQueryString) { + private String buildFilter(final Map<String, Object> filterMap, String filterQueryString, + boolean isRefTimestampKey) { StringBuilder bld = new StringBuilder(filterQueryString); for (String key : filterMap.keySet()) { - bld.append("c." + key + "= :" + key + AND); + if (isRefTimestampKey) { + bld.append("c.key.referenceKey." + key + "= :" + key + AND); + } else { + bld.append("c." + key + "= :" + key + AND); + } } return bld.toString(); } |