diff options
author | Jim Hahn <jrh3@att.com> | 2021-03-10 16:42:35 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-03-10 16:42:35 +0000 |
commit | 8031ba53c463cb6d63050b09ba9da5696c01481d (patch) | |
tree | 84a7f5793ee5a06b91bfa2242dc43763ad464108 | |
parent | 812537cd5394747eeb72409209695adbb1f2c955 (diff) | |
parent | ed19ece1be53159e265a0e400e2618ef0bd8721a (diff) |
Merge "Add support for localName based filtering in PfReferenceTimestamp key."
-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(); } |