1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.security.om.impl;
18
19 import java.sql.Timestamp;
20 import java.util.ArrayList;
21 import java.util.Collection;
22
23 import org.apache.jetspeed.security.om.InternalPrincipal;
24
25 /***
26 * <p>
27 * {@link InternalPrincipal}interface implementation.
28 * </p>
29 *
30 * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
31 */
32 public class InternalPrincipalImpl implements InternalPrincipal
33 {
34 /*** The serial version uid. */
35 private static final long serialVersionUID = 3615655651128923549L;
36
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 collection of permissions. */
50 private Collection permissions;
51
52 /*** The creation date. */
53 private Timestamp creationDate;
54
55 /*** The modified date. */
56 private Timestamp modifiedDate;
57
58 /*** The enabled state. */
59 private boolean enabled = true;
60
61 /***
62 * <p>
63 * The special attribute telling OJB the object's concrete type.
64 * </p>
65 * <p>
66 * NOTE: this attribute MUST be called ojbConcreteClass
67 * </p>
68 */
69 protected String ojbConcreteClass;
70
71 /***
72 * <p>
73 * InternalPrincipal implementation default constructor.
74 * </p>
75 */
76 public InternalPrincipalImpl()
77 {
78 }
79
80 /***
81 * <p>
82 * InternalPrincipal constructor given a classname and name.
83 * </p>
84 *
85 * @param classname The classname.
86 * @param fullPath The full path.
87 */
88 public InternalPrincipalImpl(String classname, String fullPath)
89 {
90 this.ojbConcreteClass = classname;
91 this.classname = classname;
92 this.fullPath = fullPath;
93 this.permissions = new ArrayList();
94 this.creationDate = new Timestamp(System.currentTimeMillis());
95 this.modifiedDate = this.creationDate;
96 }
97
98 /***
99 * @see org.apache.jetspeed.security.om.InternalPrincipal#getPrincipalId()
100 */
101 public long getPrincipalId()
102 {
103 return this.principalId;
104 }
105
106 /***
107 * @see org.apache.jetspeed.security.om.InternalPrincipal#setPrincipalId(long)
108 */
109 public void setPrincipalId(long principalId)
110 {
111 this.principalId = principalId;
112 }
113
114 /***
115 * @see org.apache.jetspeed.security.om.InternalPrincipal#getClassname()
116 */
117 public String getClassname()
118 {
119 return this.classname;
120 }
121
122 /***
123 * @see org.apache.jetspeed.security.om.InternalPrincipal#setClassname(java.lang.String)
124 */
125 public void setClassname(String classname)
126 {
127 this.ojbConcreteClass = classname;
128 this.classname = classname;
129 }
130
131 /***
132 * @return Returns the isMappingOnly.
133 */
134 public boolean isMappingOnly()
135 {
136 return isMappingOnly;
137 }
138
139 /***
140 * @param isMappingOnly The isMappingOnly to set.
141 */
142 public void setMappingOnly(boolean isMappingOnly)
143 {
144 this.isMappingOnly = isMappingOnly;
145 }
146
147 /***
148 * @see org.apache.jetspeed.security.om.InternalPrincipal#getFullPath()
149 */
150 public String getFullPath()
151 {
152 return this.fullPath;
153 }
154
155 /***
156 * @see org.apache.jetspeed.security.om.InternalPrincipal#setFullPath(java.lang.String)
157 */
158 public void setFullPath(String fullPath)
159 {
160 this.fullPath = fullPath;
161 }
162
163 /***
164 * @see org.apache.jetspeed.security.om.InternalPrincipal#getPermissions()
165 */
166 public Collection getPermissions()
167 {
168 return this.permissions;
169 }
170
171 /***
172 * @see org.apache.jetspeed.security.om.InternalPrincipal#setPermissions(java.util.Collection)
173 */
174 public void setPermissions(Collection permissions)
175 {
176 this.permissions = permissions;
177 }
178
179 /***
180 * @see org.apache.jetspeed.security.om.InternalPrincipal#getCreationDate()
181 */
182 public Timestamp getCreationDate()
183 {
184 return this.creationDate;
185 }
186
187 /***
188 * @see org.apache.jetspeed.security.om.InternalPrincipal#setCreationDate(java.sql.Timestamp)
189 */
190 public void setCreationDate(Timestamp creationDate)
191 {
192 this.creationDate = creationDate;
193 }
194
195 /***
196 * @see org.apache.jetspeed.security.om.InternalPrincipal#getModifiedDate()
197 */
198 public Timestamp getModifiedDate()
199 {
200 return this.modifiedDate;
201 }
202
203 /***
204 * @see org.apache.jetspeed.security.om.InternalPrincipal#setModifiedDate(java.sql.Timestamp)
205 */
206 public void setModifiedDate(Timestamp modifiedDate)
207 {
208 this.modifiedDate = modifiedDate;
209 }
210
211 /***
212 * @see org.apache.jetspeed.security.om.InternalPrincipal#isEnabled()
213 */
214 public boolean isEnabled()
215 {
216 return enabled;
217 }
218
219 /***
220 * @see org.apache.jetspeed.security.om.InternalPrincipal#setEnabled(boolean)
221 */
222 public void setEnabled(boolean enabled)
223 {
224 this.enabled = enabled;
225 }
226 }