001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/security/drm/model/SecurableObject.java $
002: /*---------------- FILE HEADER ------------------------------------------
003:
004: This file is part of deegree.
005: Copyright (C) 2001-2008 by:
006: EXSE, Department of Geography, University of Bonn
007: http://www.giub.uni-bonn.de/deegree/
008: lat/lon GmbH
009: http://www.lat-lon.de
010:
011: This library is free software; you can redistribute it and/or
012: modify it under the terms of the GNU Lesser General Public
013: License as published by the Free Software Foundation; either
014: version 2.1 of the License, or (at your option) any later version.
015:
016: This library is distributed in the hope that it will be useful,
017: but WITHOUT ANY WARRANTY; without even the implied warranty of
018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: Lesser General Public License for more details.
020:
021: You should have received a copy of the GNU Lesser General Public
022: License along with this library; if not, write to the Free Software
023: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:
025: Contact:
026:
027: Andreas Poth
028: lat/lon GmbH
029: Aennchenstr. 19
030: 53115 Bonn
031: Germany
032: E-Mail: poth@lat-lon.de
033:
034: Prof. Dr. Klaus Greve
035: Department of Geography
036: University of Bonn
037: Meckenheimer Allee 166
038: 53115 Bonn
039: Germany
040: E-Mail: greve@giub.uni-bonn.de
041:
042: ---------------------------------------------------------------------------*/
043: package org.deegree.security.drm.model;
044:
045: import org.deegree.security.drm.SecurityRegistry;
046:
047: /**
048: * Abstract superclass of objects that are securable, i.e. which carry
049: * information about which <code>Role</code>s have which <code>Right</code>s
050: * concerning these objects.
051: *
052: * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider</a>
053: * @version $Revision: 9346 $
054: */
055:
056: public abstract class SecurableObject {
057:
058: protected int id;
059: protected int type;
060: protected String name;
061: protected String title;
062: protected SecurityRegistry registry;
063:
064: /**
065: * Returns the unique identifier of this <code>SecurableObject</code>.
066: */
067: public int getID() {
068: return id;
069: }
070:
071: /**
072: * Returns the type of this <code>SecurableObject</code>.
073: * <p>
074: * NOTE: Unique in conjunction with name field.
075: *
076: */
077: public int getType() {
078: return type;
079: }
080:
081: /**
082: * Returns the name of this <code>SecurableObject</code>.
083: * <p>
084: * NOTE: Unique in conjunction with type field.
085: *
086: */
087: public String getName() {
088: return name;
089: }
090:
091: /**
092: * Returns the human readable name of this <code>SecurableObject</code>.
093: * <p>
094: * NOTE: This may not be unique.
095: *
096: */
097: public String getTitle() {
098: return title;
099: }
100:
101: /**
102: * Indicates whether some other object is "equal to" this one.
103: *
104: * @param that
105: */
106: public boolean equals(Object that) {
107: if (that instanceof SecurableObject) {
108: return (((SecurableObject) that).getID() == getID());
109: }
110: return false;
111: }
112:
113: /**
114: * Returns a hash code value for the object. This method is supported
115: * for the benefit of hashtables such as those provided by
116: * java.util.Hashtable.
117: */
118: public int hashCode() {
119: return id;
120: }
121:
122: /**
123: * Returns a <code>String</code> representation of this object.
124: */
125: public String toString() {
126: StringBuffer sb = new StringBuffer("Id: ").append(id).append(
127: ", Name: ").append(name);
128: return sb.toString();
129: }
130: }
|