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.Collection;
21
22 import org.apache.jetspeed.security.om.InternalPermission;
23
24 /***
25 * <p>{@link InternalPermission} interface implementation.</p>
26 *
27 * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
28 */
29 public class InternalPermissionImpl implements InternalPermission
30 {
31
32 /*** The serial version uid. */
33 private static final long serialVersionUID = 251708679848856538L;
34
35 /***
36 * <p>InternalPermission implementation default constructor.</p>
37 */
38 public InternalPermissionImpl()
39 {
40 }
41
42 /***
43 * <p>InternalPermission constructor.</p>
44 * @param classname The classname.
45 * @param name The name.
46 * @param actions The actions.
47 */
48 public InternalPermissionImpl(String classname, String name, String actions)
49 {
50 this.classname = classname;
51 this.name = name;
52 this.actions = actions;
53 this.creationDate = new Timestamp(System.currentTimeMillis());
54 this.modifiedDate = this.creationDate;
55 }
56
57 private long permissionId;
58
59 /***
60 * @see org.apache.jetspeed.security.om.InternalPermission#getPermissionId()
61 */
62 public long getPermissionId()
63 {
64 return this.permissionId;
65 }
66
67 /***
68 * @see org.apache.jetspeed.security.om.InternalPermission#setPermissionId(long)
69 */
70 public void setPermissionId(long permissionId)
71 {
72 this.permissionId = permissionId;
73 }
74
75 private String classname;
76
77 /***
78 * @see org.apache.jetspeed.security.om.InternalPermission#getClassname()
79 */
80 public String getClassname()
81 {
82 return this.classname;
83 }
84
85 /***
86 * @see org.apache.jetspeed.security.om.InternalPermission#setClassname(java.lang.String)
87 */
88 public void setClassname(String classname)
89 {
90 this.classname = classname;
91 }
92
93 private String name;
94
95 /***
96 * @see org.apache.jetspeed.security.om.InternalPermission#getName()
97 */
98 public String getName()
99 {
100 return this.name;
101 }
102
103 /***
104 * @see org.apache.jetspeed.security.om.InternalPermission#setName(java.lang.String)
105 */
106 public void setName(String name)
107 {
108 this.name = name;
109 }
110
111 private String actions;
112
113 /***
114 * @see org.apache.jetspeed.security.om.InternalPermission#getActions()
115 */
116 public String getActions()
117 {
118 return this.actions;
119 }
120
121 /***
122 * @see org.apache.jetspeed.security.om.InternalPermission#setActions(java.lang.String)
123 */
124 public void setActions(String actions)
125 {
126 this.actions = actions;
127 }
128
129 private Collection principals;
130
131 /***
132 * @see org.apache.jetspeed.security.om.InternalPermission#getPrincipals()
133 */
134 public Collection getPrincipals()
135 {
136 return this.principals;
137 }
138
139 /***
140 * @see org.apache.jetspeed.security.om.InternalPermission#setPrincipals(java.util.Collection)
141 */
142 public void setPrincipals(Collection principals)
143 {
144 this.principals = principals;
145 }
146
147 private Timestamp creationDate;
148
149 /***
150 * @see org.apache.jetspeed.security.om.InternalPermission#getCreationDate()
151 */
152 public Timestamp getCreationDate()
153 {
154 return this.creationDate;
155 }
156
157 /***
158 * @see org.apache.jetspeed.security.om.InternalPermission#setCreationDate(java.sql.Timestamp)
159 */
160 public void setCreationDate(Timestamp creationDate)
161 {
162 this.creationDate = creationDate;
163 }
164
165 private Timestamp modifiedDate;
166
167 /***
168 * @see org.apache.jetspeed.security.om.InternalPermission#getModifiedDate()
169 */
170 public Timestamp getModifiedDate()
171 {
172 return this.modifiedDate;
173 }
174
175 /***
176 * @see org.apache.jetspeed.security.om.InternalPermission#setModifiedDate(java.sql.Timestamp)
177 */
178 public void setModifiedDate(Timestamp modifiedDate)
179 {
180 this.modifiedDate = modifiedDate;
181 }
182
183 /***
184 * @see org.apache.jetspeed.security.om.InternalPermission#equals(java.lang.Object)
185 */
186 public boolean equals(Object object)
187 {
188 if (!(object instanceof InternalPermission))
189 return false;
190
191 InternalPermission p = (InternalPermission) object;
192 boolean isEqual =
193 ((p.getClassname().equals(this.getClassname())) && (p.getName().equals(this.getName())) && (p.getActions().equals(this.getActions())));
194 return isEqual;
195 }
196
197 }