001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/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 /** 066 * Returns the unique identifier of this <code>SecurableObject</code>. 067 */ 068 public int getID () { 069 return id; 070 } 071 072 /** 073 * Returns the type of this <code>SecurableObject</code>. 074 * <p> 075 * NOTE: Unique in conjunction with name field. 076 * 077 */ 078 public int getType() { 079 return type; 080 } 081 082 /** 083 * Returns the name of this <code>SecurableObject</code>. 084 * <p> 085 * NOTE: Unique in conjunction with type field. 086 * 087 */ 088 public String getName() { 089 return name; 090 } 091 092 /** 093 * Returns the human readable name of this <code>SecurableObject</code>. 094 * <p> 095 * NOTE: This may not be unique. 096 * 097 */ 098 public String getTitle() { 099 return title; 100 } 101 102 /** 103 * Indicates whether some other object is "equal to" this one. 104 * 105 * @param that 106 */ 107 public boolean equals (Object that) { 108 if (that instanceof SecurableObject) { 109 return (((SecurableObject) that).getID () == getID ()); 110 } 111 return false; 112 } 113 114 /** 115 * Returns a hash code value for the object. This method is supported 116 * for the benefit of hashtables such as those provided by 117 * java.util.Hashtable. 118 */ 119 public int hashCode () { 120 return id; 121 } 122 123 /** 124 * Returns a <code>String</code> representation of this object. 125 */ 126 public String toString () { 127 StringBuffer sb = new StringBuffer ("Id: "). 128 append (id).append (", Name: ").append (name); 129 return sb.toString (); 130 } 131 }