code: private String getFormattedFilter(String searchFilter, String caller, String attribute) {
          //Allow %v in addition to %s for string replacement
          String filter = searchFilter.replaceAll("%v", "%s");
          if (!(filter.startsWith("(") && filter.endsWith(")")) && !filter.isEmpty()) {
              filter = "(" + filter + ")";
          }
          if (filter.contains("%s")) {
              filter = String.format(filter, caller);
          } else {
              filter = "(&" + filter + "(" + attribute + "=" + caller + "))";
          }
          return filter;
      }
docs: Format the callerSearchFilter or groupSearchFilter. We need to check for String substitution.
  If a substitution is needed, use the result as is. Otherwise, construct the remainder of the
  filter using the name attribute of the group or caller.
  
  @param searchFilter The filter set in LdapIdentityStore
  @param caller The name of the caller whose groups or DN we are searching for
  @param attribute The attribute to use when forming the filter
  @return The new filter after string replacements or constructing the filter