1 /*
2 * <cvs:source>$Source: /devel/astrogrid/community/common/src/java/org/astrogrid/community/common/policy/data/GroupMemberData.java,v $</cvs:source>
3 * <cvs:author>$Author: jdt $</cvs:author>
4 * <cvs:date>$Date: 2004/11/22 13:03:04 $</cvs:date>
5 * <cvs:version>$Revision: 1.8 $</cvs:version>
6 *
7 * <cvs:log>
8 * $Log: GroupMemberData.java,v $
9 * Revision 1.8 2004/11/22 13:03:04 jdt
10 * Merges from Comm_KMB_585
11 *
12 * Revision 1.7 2004/10/29 15:50:05 jdt
13 * merges from Community_AdminInterface (bug 579)
14 *
15 * Revision 1.6.88.1 2004/10/18 22:10:28 KevinBenson
16 * some bug fixes to the PermissionManager. Also made it throw some exceptions.
17 * Made it and GroupManagerImnpl use the Resolver objects to actually get a group(PermissionManageriMnpl)
18 * or account (GroupMember) from the other community. Changed also for it to grab a ResourceData from the
19 * database to verifity it is in our database. Add a few of these resolver dependencies as well.
20 * And last but not least fixed the GroupMemberData object to get rid of a few set methods so Castor
21 * will now work correctly in Windows
22 *
23 * Revision 1.6 2004/07/14 13:50:07 dave
24 * Merged development branch, dave-dev-200406301228, into HEAD
25 *
26 * Revision 1.5.12.1 2004/07/05 14:18:55 dave
27 * Tried to remove the JConfig libraries
28 *
29 * Revision 1.5 2004/06/18 13:45:20 dave
30 * Merged development branch, dave-dev-200406081614, into HEAD
31 *
32 * Revision 1.4.62.1 2004/06/17 13:38:58 dave
33 * Tidied up old CVS log entries
34 *
35 * </cvs:log>
36 *
37 */
38 package org.astrogrid.community.common.policy.data ;
39
40 /***
41 * A Castor data object to represent a member of a Group.
42 * This should only be used server side, not client side.
43 * @todo Refactor this to use Ivorn identifiers.
44 *
45 *
46 */
47 public class GroupMemberData
48 {
49 /***
50 * Public constructor.
51 *
52 */
53 public GroupMemberData()
54 {
55 this(null, null) ;
56 }
57
58 /***
59 * Public constructor.
60 *
61 */
62 public GroupMemberData(String account, String group)
63 {
64 this.group = group ;
65 this.account = account ;
66 }
67
68 /***
69 * Our Account ident.
70 *
71 */
72 private String account ;
73
74 /***
75 * Access to our Account ident.
76 *
77 */
78 public String getAccount()
79 {
80 return this.account ;
81 }
82
83 /***
84 * Access to our Account ident.
85 *
86 */
87 public void setAccount(String value)
88 {
89 this.account = value ;
90 }
91
92 /***
93 * Access to our Account ident.
94 *
95
96 public void setAccount(CommunityIdent value)
97 {
98 this.account = (null != value) ? value.toString() : null ;
99 }
100 */
101 /***
102 * Our Group ident.
103 *
104 */
105 private String group ;
106
107 /***
108 * Access to our Group ident.
109 *
110 */
111 public String getGroup()
112 {
113 return this.group ;
114 }
115
116 /***
117 * Access to our Group ident.
118 *
119 */
120 public void setGroup(String value)
121 {
122 this.group = value ;
123 }
124
125 /*
126 * Compare this with another AccountData.
127 * All we want to check is the Account ident.
128 * @param object The Object to compare.
129 * @return true if the two object represetnt the same Account (the idents are equivalent).
130 * @todo Needs to refactored to check for local community in the ident.
131 * @todo Move this to a common data object base class
132 *
133 */
134 public synchronized boolean equals(Object object)
135 {
136 //
137 // If the object is null.
138 if (null == object)
139 {
140 return false ;
141 }
142 //
143 // If the object is not null.
144 else {
145 //
146 // If the object is an AccountData
147 if (object instanceof GroupMemberData)
148 {
149 GroupMemberData that = (GroupMemberData) object ;
150 //
151 // If our ident is null
152 if (null == this.account && null == this.group) {
153 return (null == that.getAccount() && null == that.getGroup()) ;
154 }else if(this.account != null && this.group != null) {
155 return (this.account.equals(that.getAccount()) && this.group.equals(that.getGroup()) ) ;
156 }else if(this.account == null && this.group != null) {
157 return (null == that.getAccount() && this.group.equals(that.getGroup())) ;
158 }else if(this.account != null && this.group == null) {
159 return (null == that.getGroup() && this.account.equals(that.getAccount()) ) ;
160 }else {
161 //impossible to get here return false.
162 return false;
163 }
164 }
165 //
166 // If that is not an AccountData
167 else {
168 return false ;
169 }
170 }
171 }
172
173
174 /***
175 * Access to our Group ident.
176 *
177
178 public void setGroup(CommunityIdent value)
179 {
180 this.group = (null != value) ? value.toString() : null ;
181 }
182 */
183
184 }