1 29 30 package hero.mapper; 31 32 import hero.util.HeroException; 33 import hero.interfaces.BnRoleLocal; 34 35 import hero.interfaces.BnLdap; 37 import hero.interfaces.BnLdapHome; 38 import hero.interfaces.BnLdapUtil; 39 import java.util.*; 40 41 42 public class LdapGroupMembers implements hero.mapper.RoleMapperI { 43 44 public Collection searchMembers(Object b,BnRoleLocal n, String userName) throws HeroException { 45 46 String roleName=n.getName(); 47 String projectName=n.getBnProject().getName(); 48 System.out.println("[Search Group Members] BnRole name:"+roleName + " - Project name = " + projectName); 49 ArrayList al =null; 50 51 BnLdapHome home = null; 52 try { 53 home = BnLdapUtil.getHome(); 54 } catch (Exception e) { 55 System.err.println( "Cannot lookup BnLdapHome: " + e); 56 System.exit(2); 57 } 58 59 BnLdap t1 = null; 60 try { 61 System.out.println("Create a bean bnLdap"); 63 t1 = home.create(); 64 } catch (Exception e) { 65 throw new HeroException("Cannot create BnLdapBean : " + e); 66 } 67 try { 68 al = (ArrayList)t1.getGroupMembers(roleName); 69 } catch (Exception e){ 70 throw new HeroException("Error getting group members for group: " + roleName + " " + e.getMessage()); 71 } 72 return al; 73 74 } 75 76 } 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | Popular Tags |