Set members = new LinkedHashSet(); try { Session     hs  = HibernateHelper.getSession(); Iterator  iter  = hs.find( "select distinct ms.member_id from Membership " + "as ms where                                " + "ms.owner_id        = ?                     " + "and ms.field.name  = ?                     " + "and ms.field.type  = ?                     ", new Object[] { g.getUuid(), f.getName(), f.getType().toString() }, new Type[] { Hibernate.STRING, Hibernate.STRING, Hibernate.STRING } ) .iterator() ; hs.close(); while (iter.hasNext()) { try { members.add( MemberFinder.findByUuid( s, (String) iter.next() ) ); } catch (MemberNotFoundException eMNF) {  }
Set       members = new LinkedHashSet(); Iterator  iter    = findMemberships(s, g, f).iterator(); while (iter.hasNext()) { Membership ms = (Membership) iter.next(); try { members.add(ms.getMember());
  protected static Set findMembers(GrouperSession s, Group g, Field f) {    // TODO Switch to criteria queries?    Set members = new LinkedHashSet();    try {      Session     hs  = HibernateHelper.getSession();      Iterator  iter  = hs.find(                          "select distinct ms.member_id from Membership "                          + "as ms where                                "                          + "ms.owner_id        = ?                     "                          + "and ms.field.name  = ?                     "                            + "and ms.field.type  = ?                     ",                          new Object[] {                            g.getUuid(), f.getName(), f.getType().toString()                          },                          new Type[] {                            Hibernate.STRING, Hibernate.STRING, Hibernate.STRING                          }                        )                        .iterator()                        ;      hs.close();      while (iter.hasNext()) {        try {          members.add(            MemberFinder.findByUuid( s, (String) iter.next() )          );        }        catch (MemberNotFoundException eMNF) {          // TODO Throw exception?  Ignore?        }      }    }    catch (HibernateException eH) {      // TODO Is a RE appropriate here?      throw new RuntimeException(        "error finding members: " + eH.getMessage()      );      }    return members;  } // protected static Set findMembers(s, g, f)