KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > usergroup > HibernateUser


1 /*
2  * Shark Hibernate UserGroup layer - Open Wide
3  */

4
5 package org.enhydra.shark.usergroup;
6
7 import java.util.ArrayList JavaDoc;
8 import java.util.Iterator JavaDoc;
9 import java.util.List JavaDoc;
10
11 /**
12  * Hibernate simple POJO class
13  * @author Vladislav Pernin
14  */

15 public class HibernateUser {
16
17     private String JavaDoc email = null;
18     private String JavaDoc passwd = null;
19     private String JavaDoc firstName = null;
20     private String JavaDoc lastName = null;
21     private String JavaDoc uid = null;
22
23     private List JavaDoc groups = new ArrayList JavaDoc();
24
25     public HibernateUser() {
26     }
27
28     public String JavaDoc getFirstName() {
29         return firstName;
30     }
31
32     public void setFirstName(String JavaDoc firstName) {
33         this.firstName = firstName;
34     }
35
36     public String JavaDoc getLastName() {
37         return lastName;
38     }
39
40     public void setLastName(String JavaDoc lastName) {
41         this.lastName = lastName;
42     }
43     
44     public String JavaDoc getEmail() {
45         return email;
46     }
47
48     public String JavaDoc getPasswd() {
49         return passwd;
50     }
51
52     public String JavaDoc getUid() {
53         return uid;
54     }
55
56     public void setEmail(String JavaDoc string) {
57         email = string;
58     }
59
60     public void setPasswd(String JavaDoc string) {
61         passwd = string;
62     }
63
64     public void setUid(String JavaDoc string) {
65         uid = string;
66     }
67
68     public List JavaDoc getGroups() {
69         return groups;
70     }
71
72     public void setGroups(List JavaDoc 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 JavaDoc toString() {
85         StringBuffer JavaDoc strBuffer = new StringBuffer JavaDoc();
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 JavaDoc 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