001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.security.om.impl;
018:
019: import java.sql.Timestamp;
020: import java.util.Collection;
021:
022: import org.apache.jetspeed.security.om.InternalPermission;
023:
024: /**
025: * <p>{@link InternalPermission} interface implementation.</p>
026: *
027: * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
028: */
029: public class InternalPermissionImpl implements InternalPermission {
030:
031: /** The serial version uid. */
032: private static final long serialVersionUID = 251708679848856538L;
033:
034: /**
035: * <p>InternalPermission implementation default constructor.</p>
036: */
037: public InternalPermissionImpl() {
038: }
039:
040: /**
041: * <p>InternalPermission constructor.</p>
042: * @param classname The classname.
043: * @param name The name.
044: * @param actions The actions.
045: */
046: public InternalPermissionImpl(String classname, String name,
047: String actions) {
048: this .classname = classname;
049: this .name = name;
050: this .actions = actions;
051: this .creationDate = new Timestamp(System.currentTimeMillis());
052: this .modifiedDate = this .creationDate;
053: }
054:
055: private long permissionId;
056:
057: /**
058: * @see org.apache.jetspeed.security.om.InternalPermission#getPermissionId()
059: */
060: public long getPermissionId() {
061: return this .permissionId;
062: }
063:
064: /**
065: * @see org.apache.jetspeed.security.om.InternalPermission#setPermissionId(long)
066: */
067: public void setPermissionId(long permissionId) {
068: this .permissionId = permissionId;
069: }
070:
071: private String classname;
072:
073: /**
074: * @see org.apache.jetspeed.security.om.InternalPermission#getClassname()
075: */
076: public String getClassname() {
077: return this .classname;
078: }
079:
080: /**
081: * @see org.apache.jetspeed.security.om.InternalPermission#setClassname(java.lang.String)
082: */
083: public void setClassname(String classname) {
084: this .classname = classname;
085: }
086:
087: private String name;
088:
089: /**
090: * @see org.apache.jetspeed.security.om.InternalPermission#getName()
091: */
092: public String getName() {
093: return this .name;
094: }
095:
096: /**
097: * @see org.apache.jetspeed.security.om.InternalPermission#setName(java.lang.String)
098: */
099: public void setName(String name) {
100: this .name = name;
101: }
102:
103: private String actions;
104:
105: /**
106: * @see org.apache.jetspeed.security.om.InternalPermission#getActions()
107: */
108: public String getActions() {
109: return this .actions;
110: }
111:
112: /**
113: * @see org.apache.jetspeed.security.om.InternalPermission#setActions(java.lang.String)
114: */
115: public void setActions(String actions) {
116: this .actions = actions;
117: }
118:
119: private Collection principals;
120:
121: /**
122: * @see org.apache.jetspeed.security.om.InternalPermission#getPrincipals()
123: */
124: public Collection getPrincipals() {
125: return this .principals;
126: }
127:
128: /**
129: * @see org.apache.jetspeed.security.om.InternalPermission#setPrincipals(java.util.Collection)
130: */
131: public void setPrincipals(Collection principals) {
132: this .principals = principals;
133: }
134:
135: private Timestamp creationDate;
136:
137: /**
138: * @see org.apache.jetspeed.security.om.InternalPermission#getCreationDate()
139: */
140: public Timestamp getCreationDate() {
141: return this .creationDate;
142: }
143:
144: /**
145: * @see org.apache.jetspeed.security.om.InternalPermission#setCreationDate(java.sql.Timestamp)
146: */
147: public void setCreationDate(Timestamp creationDate) {
148: this .creationDate = creationDate;
149: }
150:
151: private Timestamp modifiedDate;
152:
153: /**
154: * @see org.apache.jetspeed.security.om.InternalPermission#getModifiedDate()
155: */
156: public Timestamp getModifiedDate() {
157: return this .modifiedDate;
158: }
159:
160: /**
161: * @see org.apache.jetspeed.security.om.InternalPermission#setModifiedDate(java.sql.Timestamp)
162: */
163: public void setModifiedDate(Timestamp modifiedDate) {
164: this .modifiedDate = modifiedDate;
165: }
166:
167: /**
168: * @see org.apache.jetspeed.security.om.InternalPermission#equals(java.lang.Object)
169: */
170: public boolean equals(Object object) {
171: if (!(object instanceof InternalPermission))
172: return false;
173:
174: InternalPermission p = (InternalPermission) object;
175: boolean isEqual = ((p.getClassname()
176: .equals(this.getClassname()))
177: && (p.getName().equals(this.getName())) && (p
178: .getActions().equals(this.getActions())));
179: return isEqual;
180: }
181:
182: }
|