    001    // $HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/security/drm/model/RightType.java $
    002    /*----------------------------------------------------------------------------
    003     This file is part of deegree, http://deegree.org/
    004     Copyright (C) 2001-2009 by:
    005       Department of Geography, University of Bonn
    006     and
    007       lat/lon GmbH
    008
    009     This library is free software; you can redistribute it and/or modify it under
    010     the terms of the GNU Lesser General Public License as published by the Free
    011     Software Foundation; either version 2.1 of the License, or (at your option)
    012     any later version.
    013     This library is distributed in the hope that it will be useful, but WITHOUT
    014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
    016     details.
    017     You should have received a copy of the GNU Lesser General Public License
    018     along with this library; if not, write to the Free Software Foundation, Inc.,
    019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    020
    021     Contact information:
    022
    023     lat/lon GmbH
    024     Aennchenstr. 19, 53177 Bonn
    025     Germany
    026     http://lat-lon.de/
    027
    028     Department of Geography, University of Bonn
    029     Prof. Dr. Klaus Greve
    030     Postfach 1147, 53001 Bonn
    031     Germany
    032     http://www.geographie.uni-bonn.de/deegree/
    033
    034     e-mail: info@deegree.org
    035    ----------------------------------------------------------------------------*/
    036    package org.deegree.security.drm.model;
    037
    038    /**
    039     * A <code>RightType</code> defines a certain type of right, e.g. an 'access' right. It
    040     * encapsulates a unique id and an also unique name.
    041     *
    042     *
    043     * @version $Revision: 18195 $
    044     * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider</a>
    045     * @author last edited by: $Author: mschneider $
    046     *
    047     * @version 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
    048     *
    049     * @since 2.0
    050     */
    051    public class RightType {
    052
    053        // predefined right types
    054        // general
    055        public static final RightType ACCESS = new RightType( 1, "access" );
    056
    057        public static final RightType QUERY = new RightType( 2, "query" );
    058
    059        public static final RightType DELETE = new RightType( 3, "delete" );
    060
    061        public static final RightType DELETE_RESPONSE = new RightType( 1003, "delete_Response" );
    062
    063        public static final RightType INSERT = new RightType( 4, "insert" );
    064
    065        public static final RightType INSERT_RESPONSE = new RightType( 1004, "insert_Response" );
    066
    067        public static final RightType EXECUTE = new RightType( 5, "execute" );
    068
    069        public static final RightType UPDATE = new RightType( 6, "update" );
    070
    071        public static final RightType UPDATE_RESPONSE = new RightType( 1006, "update_Response" );
    072
    073        public static final RightType VIEW = new RightType( 7, "view" );
    074
    075        public static final RightType GRANT = new RightType( 8, "grant" );
    076
    077        // WMS
    078        public static final RightType GETMAP = new RightType( 9, "GetMap" );
    079
    080        public static final RightType GETMAP_RESPONSE = new RightType( 1009, "GetMap_Response" );
    081
    082        public static final RightType GETFEATUREINFO = new RightType( 10, "GetFeatureInfo" );
    083
    084        public static final RightType GETFEATUREINFO_RESPONSE = new RightType( 1010, "GetFeatureInfo_Response" );
    085
    086        public static final RightType GETLEGENDGRAPHIC = new RightType( 11, "GetLegendGraphic" );
    087
    088        public static final RightType GETLEGENDGRAPHIC_RESPONSE = new RightType( 1011, "GetLegendGraphic_Response" );
    089
    090        // WFS
    091        public static final RightType GETFEATURE = new RightType( 13, "GetFeature" );
    092
    093        public static final RightType GETFEATURE_RESPONSE = new RightType( 1013, "GetFeature_Response" );
    094
    095        public static final RightType DESCRIBEFEATURETYPE = new RightType( 14, "DescribeFeatureType" );
    096
    097        public static final RightType DESCRIBEFEATURETYPE_RESPONSE = new RightType( 1014, "DescribeFeatureType_Response" );
    098
    099        // WCS
    100        public static final RightType GETCOVERAGE = new RightType( 15, "GetCoverage" );
    101
    102        public static final RightType GETCOVERAGE_RESPONSE = new RightType( 1015, "GetCoverage_Response" );
    103
    104        public static final RightType DESCRIBECOVERAGE = new RightType( 16, "DescribeCoverage" );
    105
    106        public static final RightType DESCRIBECOVERAGE_RESPONSE = new RightType( 1016, "DescribeCoverage_Response" );
    107
    108        // CSW
    109        public static final RightType GETRECORDS = new RightType( 17, "GetRecords" );
    110
    111        public static final RightType GETRECORDS_RESPONSE = new RightType( 1017, "GetRecords_Response" );
    112
    113        public static final RightType GETRECORDBYID = new RightType( 18, "GetRecordById" );
    114
    115        public static final RightType GETRECORDBYID_RESPONSE = new RightType( 1018, "GetRecordById_Response" );
    116
    117        public static final RightType DESCRIBERECORDTYPE = new RightType( 19, "DescribeRecordType" );
    118
    119        public static final RightType DESCRIBERECORDTYPE_RESPONSE = new RightType( 1019, "DescribeRecordType_Response" );
    120
    121        // ebrim CSW profile
    122        public static final RightType GETREPOSITORYITEM = new RightType( 20, "GetRepositoryItem" );
    123
    124        public static final RightType GETREPOSITORYITEM_RESPONSE = new RightType( 1020, "GetRepositoryItem_Response" );
    125
    126        private int id;
    127
    128        private String name;
    129
    130        /**
    131         * Creates a new <code>RightType</code>-instance.
    132         *
    133         * @param id
    134         * @param name
    135         */
    136        public RightType( int id, String name ) {
    137            this.id = id;
    138            this.name = name;
    139        }
    140
    141        /**
    142         * Returns the unique identifier of this <code>RightType</code>.
    143         */
    144        public int getID() {
    145            return id;
    146        }
    147
    148        /**
    149         * Returns the name of this <code>RightType</code>.
    150         *
    151         */
    152        public String getName() {
    153            return name;
    154        }
    155
    156        /**
    157         * Indicates whether some other <code>RightType</code> instance is "equal to" this one.
    158         *
    159         * @param that
    160         */
    161        public boolean equals( Object that ) {
    162            if ( that instanceof RightType ) {
    163                return ( ( (RightType) that ).getID() == getID() );
    164            }
    165            return false;
    166        }
    167
    168        /**
    169         * Returns a hash code value for the object. This method is supported for the benefit of
    170         * hashtables such as those provided by java.util.Hashtable.
    171         */
    172        public int hashCode() {
    173            return id;
    174        }
    175
    176        /**
    177         * Returns a <code>String</code> representation of this object.
    178         */
    179        public String toString() {
    180            StringBuffer sb = new StringBuffer( "Id: " ).append( id ).append( ", Name: " ).append( name );
    181            return sb.toString();
    182        }
    183    }