Group[] specialGroups = c.getSpecialGroups(); for(int j=0; j<specialGroups.length;j++) groupIDs.add(new Integer(specialGroups[j].getID()));
    public static Set allMemberGroupIDs(Context c, EPerson e)            throws SQLException    {        // two queries - first to get groups eperson is a member of        // second query gets parent groups for groups eperson is a member of        TableRowIterator tri = DatabaseManager.queryTable(c, "epersongroup2eperson",                "SELECT * FROM epersongroup2eperson WHERE eperson_id= ?",                 e.getID());        Set groupIDs = new HashSet();        while (tri.hasNext())        {            TableRow row = tri.next();            int childID = row.getIntColumn("eperson_group_id");            groupIDs.add(new Integer(childID));        }                tri.close();        // now we have all owning groups, also grab all parents of owning groups        // yes, I know this could have been done as one big query and a union,        // but doing the Oracle port taught me to keep to simple SQL!        String groupQuery = "";        Iterator i = groupIDs.iterator();        // Build a list of query parameters        Object[] parameters = new Object[groupIDs.size()];        int idx = 0;        while (i.hasNext())        {            int groupID = ((Integer) i.next()).intValue();            parameters[idx++] = new Integer(groupID);                        groupQuery += "child_id= ? ";            if (i.hasNext())                groupQuery += " OR ";        }        if ("".equals(groupQuery))        {            // don't do query, isn't member of any groups            return groupIDs;        }                // was member of at least one group        // NOTE: even through the query is built dynamicaly all data is seperated into the        // the parameters array.        tri = DatabaseManager.queryTable(c, "group2groupcache",                "SELECT * FROM group2groupcache WHERE " + groupQuery,                parameters);        while (tri.hasNext())        {            TableRow row = tri.next();            int parentID = row.getIntColumn("parent_id");            groupIDs.add(new Integer(parentID));        }                tri.close();        return groupIDs;    }