private static String buildListQuery(IResource resource, String of) {
    List<String> vars = Lists.newArrayList(Auth.AUTH_KS, PERMISSIONS_CF);
    List<String> conditions = new ArrayList<String>();

    if (resource != null) {
      conditions.add("resource = '%s'");
      vars.add(escape(resource.getName()));
    }

    if (of != null) {
      conditions.add("username = '******'");
      vars.add(escape(of));
    }

    String query = "SELECT username, resource, permissions FROM %s.%s";

    if (!conditions.isEmpty()) query += " WHERE " + StringUtils.join(conditions, " AND ");

    if (resource != null && of == null) query += " ALLOW FILTERING";

    return String.format(query, vars.toArray());
  }
 public void addColumnAlias(ColumnIdentifier alias) {
   columnAliases.add(alias);
 }