1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jetspeed.sso.impl;
19
20 import java.sql.Timestamp;
21 import java.util.Collection;
22 import java.util.Vector;
23
24 import org.apache.jetspeed.security.om.InternalUserPrincipal;
25 import org.apache.jetspeed.sso.SSOPrincipal;
26
27 /***
28 * <p>
29 * SSOPrincipalImpl
30 * Class used for mapping Principal information for a site. This is the short form of
31 * the InternalPrincipalImpl
32 * .</p>
33 *
34 * @author <a href="mailto:rogerrut @apache.org">Roger Ruttimann</a>
35 */
36 public class SSOPrincipalImpl implements SSOPrincipal {
37 /*** The principal id. */
38 private long principalId;
39
40 /*** The class name. */
41 private String classname;
42
43 /*** The is mapping only. */
44 private boolean isMappingOnly = false;
45
46 /*** The full path. */
47 private String fullPath;
48
49 /*** The creation date. */
50 private Timestamp creationDate;
51
52 /*** The modified date. */
53 private Timestamp modifiedDate;
54
55 /*** The enabled state. */
56 private boolean enabled = true;
57
58 /*** Permissions not used by required by the interface*/
59 private Collection permissions;
60
61 /*** Remote principals for Principal */
62 private Collection remotePrincipals = new Vector();
63
64 /*** SIteID for Remote principal */
65 private int siteID;
66
67
68 /***
69 * <p>
70 * The special attribute telling OJB the object's concrete type.
71 * </p>
72 * <p>
73 * NOTE: this attribute MUST be called ojbConcreteClass
74 * </p>
75 */
76 protected String ojbConcreteClass;
77
78 /***
79 * <p>
80 * InternalPrincipal implementation default constructor.
81 * </p>
82 */
83 public SSOPrincipalImpl()
84 {
85 }
86
87 /***
88 * <p>
89 * InternalPrincipal constructor given a classname and name.
90 * </p>
91 *
92 * @param classname The classname.
93 * @param fullPath The full path.
94 */
95 public SSOPrincipalImpl(String classname, String fullPath)
96 {
97 this.ojbConcreteClass = classname;
98 this.classname = classname;
99 this.fullPath = fullPath;
100 this.permissions = null;
101 this.creationDate = new Timestamp(System.currentTimeMillis());
102 this.modifiedDate = this.creationDate;
103 }
104
105 /***
106 * addRemotePrincipal()
107 * adds a principal to the list of remote principals
108 */
109 public void addRemotePrincipal(InternalUserPrincipal principal)
110 {
111
112
113
114
115
116
117 remotePrincipals.add(principal);
118 }
119
120 /***
121 * @see org.apache.jetspeed.security.om.InternalPrincipal#getPrincipalId()
122 */
123 public long getPrincipalId()
124 {
125 return this.principalId;
126 }
127
128 /***
129 * @see org.apache.jetspeed.security.om.InternalPrincipal#setPrincipalId(int)
130 */
131 public void setPrincipalId(long principalId)
132 {
133 this.principalId = principalId;
134 }
135
136 /***
137 * @see org.apache.jetspeed.security.om.InternalPrincipal#getClassname()
138 */
139 public String getClassname()
140 {
141 return this.classname;
142 }
143
144 /***
145 * @see org.apache.jetspeed.security.om.InternalPrincipal#setClassname(java.lang.String)
146 */
147 public void setClassname(String classname)
148 {
149 this.ojbConcreteClass = classname;
150 this.classname = classname;
151 }
152
153 /***
154 * @return Returns the isMappingOnly.
155 */
156 public boolean isMappingOnly()
157 {
158 return isMappingOnly;
159 }
160
161 /***
162 * @param isMappingOnly The isMappingOnly to set.
163 */
164 public void setMappingOnly(boolean isMappingOnly)
165 {
166 this.isMappingOnly = isMappingOnly;
167 }
168
169 /***
170 * @see org.apache.jetspeed.security.om.InternalPrincipal#getFullPath()
171 */
172 public String getFullPath()
173 {
174 return this.fullPath;
175 }
176
177 /***
178 * @see org.apache.jetspeed.security.om.InternalPrincipal#setFullPath(java.lang.String)
179 */
180 public void setFullPath(String fullPath)
181 {
182 this.fullPath = fullPath;
183 }
184
185 /***
186 * @see org.apache.jetspeed.security.om.InternalPrincipal#getPermissions()
187 */
188 public Collection getPermissions()
189 {
190 return this.permissions;
191 }
192
193 /***
194 * @see org.apache.jetspeed.security.om.InternalPrincipal#setPermissions(java.util.Collection)
195 */
196 public void setPermissions(Collection permissions)
197 {
198 this.permissions = permissions;
199 }
200
201 /***
202 * @see org.apache.jetspeed.security.om.InternalPrincipal#getCreationDate()
203 */
204 public Timestamp getCreationDate()
205 {
206 return this.creationDate;
207 }
208
209 /***
210 * @see org.apache.jetspeed.security.om.InternalPrincipal#setCreationDate(java.sql.Timestamp)
211 */
212 public void setCreationDate(Timestamp creationDate)
213 {
214 this.creationDate = creationDate;
215 }
216
217 /***
218 * @see org.apache.jetspeed.security.om.InternalPrincipal#getModifiedDate()
219 */
220 public Timestamp getModifiedDate()
221 {
222 return this.modifiedDate;
223 }
224
225 /***
226 * @see org.apache.jetspeed.security.om.InternalPrincipal#setModifiedDate(java.sql.Timestamp)
227 */
228 public void setModifiedDate(Timestamp modifiedDate)
229 {
230 this.modifiedDate = modifiedDate;
231 }
232
233 /***
234 * @see org.apache.jetspeed.security.om.InternalPrincipal#isEnabled()
235 */
236 public boolean isEnabled()
237 {
238 return enabled;
239 }
240
241 /***
242 * @see org.apache.jetspeed.security.om.InternalPrincipal#setEnabled(boolean)
243 */
244 public void setEnabled(boolean enabled)
245 {
246 this.enabled = enabled;
247 }
248 /***
249 * @return Returns the remotePrincipals.
250 */
251 public Collection getRemotePrincipals() {
252 return remotePrincipals;
253 }
254 /***
255 * @param remotePrincipals The remotePrincipals to set.
256 */
257 public void setRemotePrincipals(Collection remotePrincipals) {
258 this.remotePrincipals = remotePrincipals;
259 }
260 /***
261 * @return Returns the siteID.
262 */
263 public int getSiteID() {
264 return siteID;
265 }
266 /***
267 * @param siteID The siteID to set.
268 */
269 public void setSiteID(int siteID) {
270 this.siteID = siteID;
271 }
272 }
273