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.ArrayList;
021: import java.util.Collection;
022:
023: import org.apache.jetspeed.security.om.InternalPrincipal;
024:
025: /**
026: * <p>
027: * {@link InternalPrincipal}interface implementation.
028: * </p>
029: *
030: * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
031: */
032: public class InternalPrincipalImpl implements InternalPrincipal {
033: /** The serial version uid. */
034: private static final long serialVersionUID = 3615655651128923549L;
035:
036: /** The principal id. */
037: private long principalId;
038:
039: /** The class name. */
040: private String classname;
041:
042: /** The is mapping only. */
043: private boolean isMappingOnly = false;
044:
045: /** The full path. */
046: private String fullPath;
047:
048: /** The collection of permissions. */
049: private Collection permissions;
050:
051: /** The creation date. */
052: private Timestamp creationDate;
053:
054: /** The modified date. */
055: private Timestamp modifiedDate;
056:
057: /** The enabled state. */
058: private boolean enabled = true;
059:
060: /**
061: * <p>
062: * The special attribute telling OJB the object's concrete type.
063: * </p>
064: * <p>
065: * NOTE: this attribute MUST be called ojbConcreteClass
066: * </p>
067: */
068: protected String ojbConcreteClass;
069:
070: /**
071: * <p>
072: * InternalPrincipal implementation default constructor.
073: * </p>
074: */
075: public InternalPrincipalImpl() {
076: }
077:
078: /**
079: * <p>
080: * InternalPrincipal constructor given a classname and name.
081: * </p>
082: *
083: * @param classname The classname.
084: * @param fullPath The full path.
085: */
086: public InternalPrincipalImpl(String classname, String fullPath) {
087: this .ojbConcreteClass = classname;
088: this .classname = classname;
089: this .fullPath = fullPath;
090: this .permissions = new ArrayList();
091: this .creationDate = new Timestamp(System.currentTimeMillis());
092: this .modifiedDate = this .creationDate;
093: }
094:
095: /**
096: * @see org.apache.jetspeed.security.om.InternalPrincipal#getPrincipalId()
097: */
098: public long getPrincipalId() {
099: return this .principalId;
100: }
101:
102: /**
103: * @see org.apache.jetspeed.security.om.InternalPrincipal#setPrincipalId(long)
104: */
105: public void setPrincipalId(long principalId) {
106: this .principalId = principalId;
107: }
108:
109: /**
110: * @see org.apache.jetspeed.security.om.InternalPrincipal#getClassname()
111: */
112: public String getClassname() {
113: return this .classname;
114: }
115:
116: /**
117: * @see org.apache.jetspeed.security.om.InternalPrincipal#setClassname(java.lang.String)
118: */
119: public void setClassname(String classname) {
120: this .ojbConcreteClass = classname;
121: this .classname = classname;
122: }
123:
124: /**
125: * @return Returns the isMappingOnly.
126: */
127: public boolean isMappingOnly() {
128: return isMappingOnly;
129: }
130:
131: /**
132: * @param isMappingOnly The isMappingOnly to set.
133: */
134: public void setMappingOnly(boolean isMappingOnly) {
135: this .isMappingOnly = isMappingOnly;
136: }
137:
138: /**
139: * @see org.apache.jetspeed.security.om.InternalPrincipal#getFullPath()
140: */
141: public String getFullPath() {
142: return this .fullPath;
143: }
144:
145: /**
146: * @see org.apache.jetspeed.security.om.InternalPrincipal#setFullPath(java.lang.String)
147: */
148: public void setFullPath(String fullPath) {
149: this .fullPath = fullPath;
150: }
151:
152: /**
153: * @see org.apache.jetspeed.security.om.InternalPrincipal#getPermissions()
154: */
155: public Collection getPermissions() {
156: return this .permissions;
157: }
158:
159: /**
160: * @see org.apache.jetspeed.security.om.InternalPrincipal#setPermissions(java.util.Collection)
161: */
162: public void setPermissions(Collection permissions) {
163: this .permissions = permissions;
164: }
165:
166: /**
167: * @see org.apache.jetspeed.security.om.InternalPrincipal#getCreationDate()
168: */
169: public Timestamp getCreationDate() {
170: return this .creationDate;
171: }
172:
173: /**
174: * @see org.apache.jetspeed.security.om.InternalPrincipal#setCreationDate(java.sql.Timestamp)
175: */
176: public void setCreationDate(Timestamp creationDate) {
177: this .creationDate = creationDate;
178: }
179:
180: /**
181: * @see org.apache.jetspeed.security.om.InternalPrincipal#getModifiedDate()
182: */
183: public Timestamp getModifiedDate() {
184: return this .modifiedDate;
185: }
186:
187: /**
188: * @see org.apache.jetspeed.security.om.InternalPrincipal#setModifiedDate(java.sql.Timestamp)
189: */
190: public void setModifiedDate(Timestamp modifiedDate) {
191: this .modifiedDate = modifiedDate;
192: }
193:
194: /**
195: * @see org.apache.jetspeed.security.om.InternalPrincipal#isEnabled()
196: */
197: public boolean isEnabled() {
198: return enabled;
199: }
200:
201: /**
202: * @see org.apache.jetspeed.security.om.InternalPrincipal#setEnabled(boolean)
203: */
204: public void setEnabled(boolean enabled) {
205: this.enabled = enabled;
206: }
207: }
|