Skip to content

Commit

Permalink
HCMPRE-2212 making facilityId in plan search a set for multiple drop …
Browse files Browse the repository at this point in the history
…down search, changes filterMap signature.
  • Loading branch information
Priyanka-eGov committed Jan 27, 2025
1 parent 1e2505b commit b561a96
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public String addOrderByClause(String query, String orderByClause) {
* @param filterMap
* @return
*/
public String preparePartialJsonStringFromFilterMap(Map<String, String> filterMap) {
public String preparePartialJsonStringFromFilterMap(Map<String, Set<String>> filterMap) {
Map<String, Object> queryMap = new HashMap<>();

filterMap.keySet().forEach(key -> {
Expand All @@ -129,24 +129,24 @@ public String preparePartialJsonStringFromFilterMap(Map<String, String> filterMa
* @param index
* @param nestedKeyArray
* @param currentQueryMap
* @param value
* @param values
*/
private void prepareNestedQueryMap(int index, String[] nestedKeyArray, Map<String, Object> currentQueryMap, String value) {
private void prepareNestedQueryMap(int index, String[] nestedKeyArray, Map<String, Object> currentQueryMap, Set<String> values) {
// Return when all levels have been reached.
if (index == nestedKeyArray.length)
return;

// For the final level simply put the value in the map.
else if (index == nestedKeyArray.length - 1) {
currentQueryMap.put(nestedKeyArray[index], value);
currentQueryMap.put(nestedKeyArray[index], values);
return;
}

// For non terminal levels, add a child map.
currentQueryMap.put(nestedKeyArray[index], new HashMap<>());

// Make a recursive call to enrich data in next level.
prepareNestedQueryMap(index + 1, nestedKeyArray, (Map<String, Object>) currentQueryMap.get(nestedKeyArray[index]), value);
prepareNestedQueryMap(index + 1, nestedKeyArray, (Map<String, Object>) currentQueryMap.get(nestedKeyArray[index]), values);
}

/**
Expand Down

0 comments on commit b561a96

Please sign in to comment.