public Query findDnByUserAndGroupSearch(String user, String userDn, String groupSearchFilter) {
    if (groupSearchFilter != null) {
      groupSearchFilter = groupSearchFilter.replaceAll("\\{0\\}", userDn);
      groupSearchFilter = groupSearchFilter.replaceAll("\\{1\\}", user);
    }
    return Query.builder()
        .filter(groupSearchFilter)
        .build();
  }
Returns a query for finding matches based on user and group filter query.
@param user user RDN to replace {0}
@param userDn user DN to replace {1}}
@param groupSearchFilter search query that includes any group filter conditions.
@return an instance of {@link Query}
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ldap/QueryFactory.java