Source:
public String buildConditionSql(String objName, String fieldName, String customizedValue, String customizedRelation, String tableName, boolean caseSensitive) { Pair<String, String> pair = new Pair<>(); pair.setFirst(customizedRelation); pair.setSecond(customizedValue); formatValue(fieldName, pair, caseSensitive); if (("''".equals(pair.getSecond()) || "'null'".equalsIgnoreCase(pair.getSecond())) && ("=".equals(pair.getFirst()) || "!=".equals(pair.getFirst()))) { String nullRelation = "=".equals(pair.getFirst()) ? "IS" : "IS NOT"; return StringFormat.format("(%1$s.%2$s %3$s NULL)", tableName, getDbFieldName(fieldName), nullRelation); } else { SearchObjectAutoCompleter.EntitySearchInfo info = SearchObjectAutoCompleter.getEntitySearchInfo(objName); if (info.commaDelimitedListColumns != null && info.commaDelimitedListColumns.contains(fieldName.toLowerCase())) { String operator = "NOT LIKE".equals(pair.getFirst().trim()) ? " LIKE" : pair.getFirst(); String conditionFormat = "NOT LIKE".equals(pair.getFirst().trim()) ? "NOT %1$s %2$s ANY(string_to_array(%3$s.%4$s, ','))" : "%1$s %2$s ANY(string_to_array(%3$s.%4$s, ','))"; return StringFormat.format(conditionFormat, pair.getSecond().replace("\\_", "_"), operator, tableName, getDbFieldName(fieldName)); } String formatString; if (pair.getFirst().trim().equalsIgnoreCase("NOT LIKE") || pair.getFirst().trim().equalsIgnoreCase("NOT ILIKE")) { formatString = " (%1$s.%2$s IS NULL OR %1$s.%2$s %3$s %4$s) "; } else { formatString = " %1$s.%2$s %3$s %4$s "; } return StringFormat.format(formatString, tableName, getDbFieldName(fieldName), pair.getFirst(), pair.getSecond()); } }

Target:
public String buildConditionSql(String objName, String fieldName, String customizedValue, String customizedRelation, String tableName, boolean caseSensitive) { Pair<String, String> pair = new Pair<>(); pair.setFirst(customizedRelation); pair.setSecond(customizedValue); formatValue(fieldName, pair, caseSensitive); if (("''".equals(pair.getSecond()) || "'null'".equalsIgnoreCase(pair.getSecond())) && ("=".equals(pair.getFirst()) || "!=".equals(pair.getFirst()))) { String nullRelation = "=".equals(pair.getFirst()) ? "IS" : "IS NOT"; return StringFormat.format("(%1$s.%2$s %3$s NULL)", tableName, getDbFieldName(fieldName), nullRelation); } else { SearchObjectAutoCompleter.EntitySearchInfo info = SearchObjectAutoCompleter.getEntitySearchInfo(objName); if (info.commaDelimitedListColumns != null && info.commaDelimitedListColumns.contains(fieldName.toLowerCase())) { String operator = "NOT LIKE".equals(pair.getFirst().trim()) ? " LIKE" : pair.getFirst(); String conditionFormat = "NOT LIKE".equals(pair.getFirst().trim()) ? "NOT %1$s %2$s ANY(string_to_array(%3$s.%4$s, ','))" : "%1$s %2$s ANY(string_to_array(%3$s.%4$s, ','))"; return StringFormat.format(conditionFormat, pair.getSecond().replace("\\_", "_"), operator, tableName, getDbFieldName(fieldName)); } String formatString; if (pair.getFirst().trim().equalsIgnoreCase("NOT LIKE") || pair.getFirst().equalsIgnoreCase("NOT ILIKE")) { formatString = " (%1$s.%2$s IS NULL OR %1$s.%2$s %3$s %4$s) "; } else { formatString = " %1$s.%2$s %3$s %4$s "; } return StringFormat.format(formatString, tableName, getDbFieldName(fieldName), pair.getFirst(), pair.getSecond()); } }