001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/security/drm/model/Service.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    
037    package org.deegree.security.drm.model;
038    
039    import static java.util.Collections.unmodifiableList;
040    
041    import java.util.List;
042    
043    import org.deegree.framework.util.StringPair;
044    
045    /**
046     * <code>Service</code>
047     * 
048     * @author <a href="mailto:schmitz@lat-lon.de">Andreas Schmitz</a>
049     * @author last edited by: $Author: aschmitz $
050     * 
051     * @version $Revision: 25490 $, $Date: 2010-07-26 11:47:34 +0200 (Mo, 26 Jul 2010) $
052     */
053    public class Service extends SecurableObject {
054    
055        private final String address;
056    
057        private final String title;
058    
059        private final List<StringPair> objects;
060    
061        private final int id;
062    
063        private final String type;
064    
065        /**
066         * @param id
067         * @param address
068         * @param title
069         * @param objects
070         * @param type
071         */
072        public Service( int id, String address, String title, List<StringPair> objects, String type ) {
073            this.id = id;
074            this.address = address;
075            this.title = title;
076            this.objects = objects;
077            this.type = type;
078        }
079    
080        /**
081         * @return the address
082         */
083        public String getAddress() {
084            return address;
085        }
086    
087        /**
088         * @return the title
089         */
090        public String getServiceTitle() {
091            return title;
092        }
093    
094        /**
095         * @return the objects of the service
096         */
097        public List<StringPair> getObjects() {
098            return unmodifiableList( objects );
099        }
100    
101        /**
102         * @return the db id
103         */
104        public int getId() {
105            return id;
106        }
107    
108        /**
109         * @return the service type (WMS/WFS)
110         */
111        public String getServiceType() {
112            return type;
113        }
114    
115        @Override
116        public String toString() {
117            return "Service: ID " + id + ", address " + address + ", title '" + title + "'. Objects:\n" + objects;
118        }
119    
120        @Override
121        public boolean equals( Object that ) {
122            if ( !( that instanceof Service ) ) {
123                return false;
124            }
125            return ( (Service) that ).id == id;
126        }
127    
128        @Override
129        public int hashCode() {
130            return id;
131        }
132    
133    }