1 4 5 package org.enhydra.shark.usergroup; 6 7 import java.util.ArrayList ; 8 import java.util.Iterator ; 9 import java.util.List ; 10 11 15 public class HibernateUser { 16 17 private String email = null; 18 private String passwd = null; 19 private String firstName = null; 20 private String lastName = null; 21 private String uid = null; 22 23 private List groups = new ArrayList (); 24 25 public HibernateUser() { 26 } 27 28 public String getFirstName() { 29 return firstName; 30 } 31 32 public void setFirstName(String firstName) { 33 this.firstName = firstName; 34 } 35 36 public String getLastName() { 37 return lastName; 38 } 39 40 public void setLastName(String lastName) { 41 this.lastName = lastName; 42 } 43 44 public String getEmail() { 45 return email; 46 } 47 48 public String getPasswd() { 49 return passwd; 50 } 51 52 public String getUid() { 53 return uid; 54 } 55 56 public void setEmail(String string) { 57 email = string; 58 } 59 60 public void setPasswd(String string) { 61 passwd = string; 62 } 63 64 public void setUid(String string) { 65 uid = string; 66 } 67 68 public List getGroups() { 69 return groups; 70 } 71 72 public void setGroups(List list) { 73 groups = list; 74 } 75 76 public void addGroup(HibernateGroup group) { 77 if (!groups.contains(group)) groups.add(group); 78 } 79 80 public void removeGroup(HibernateGroup group) { 81 groups.remove(group); 82 } 83 84 public String toString() { 85 StringBuffer strBuffer = new StringBuffer (); 86 strBuffer.append("\tuid = " + this.uid + "\n"); 87 strBuffer.append("\temail = " + this.email + "\n"); 88 strBuffer.append("\tpasswd = " + this.passwd + "\n"); 89 strBuffer.append("\tname = " + this.firstName + "\n"); 90 strBuffer.append("\tname = " + this.lastName + "\n"); 91 strBuffer.append("\t**************GROUPS************* \n"); 92 if (groups.size() != 0) { 93 for (Iterator it = groups.iterator(); it.hasNext();) { 94 HibernateGroup gr = (HibernateGroup) it.next(); 95 if (gr != null) { 96 strBuffer.append("\tgroups = " + gr.getGid() + "\n"); 97 } else { 98 strBuffer.append("\tgroups NULL!\n"); 99 } 100 } 101 } else { 102 strBuffer.append("\tno groups \n"); 103 } 104 strBuffer.append("\t************** END GROUPS************* \n"); 105 return strBuffer.toString(); 106 } 107 108 } | Popular Tags |