001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/model/metadata/iso19115/Address.java $
002    /*
003    /*----------------------------------------------------------------------------
004     This file is part of deegree, http://deegree.org/
005     Copyright (C) 2001-2009 by:
006       Department of Geography, University of Bonn
007     and
008       lat/lon GmbH
009    
010     This library is free software; you can redistribute it and/or modify it under
011     the terms of the GNU Lesser General Public License as published by the Free
012     Software Foundation; either version 2.1 of the License, or (at your option)
013     any later version.
014     This library is distributed in the hope that it will be useful, but WITHOUT
015     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
016     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
017     details.
018     You should have received a copy of the GNU Lesser General Public License
019     along with this library; if not, write to the Free Software Foundation, Inc.,
020     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021    
022     Contact information:
023    
024     lat/lon GmbH
025     Aennchenstr. 19, 53177 Bonn
026     Germany
027     http://lat-lon.de/
028    
029     Department of Geography, University of Bonn
030     Prof. Dr. Klaus Greve
031     Postfach 1147, 53001 Bonn
032     Germany
033     http://www.geographie.uni-bonn.de/deegree/
034    
035     e-mail: info@deegree.org
036    ----------------------------------------------------------------------------*/
037    
038    package org.deegree.model.metadata.iso19115;
039    
040    import java.util.ArrayList;
041    
042    /**
043     * Address object.
044     *
045     *
046     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
047     * @author last edited by: $Author: mschneider $
048     *
049     * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
050     */
051    public class Address {
052    
053        private String administrativearea = null;
054    
055        private String city = null;
056    
057        private String country = null;
058    
059        private ArrayList<String> deliverypoint = null;
060    
061        private ArrayList<String> electronicmailaddress = null;
062    
063        private String postalcode = null;
064    
065        /**
066         * Address
067         *
068         * @param administrativearea
069         * @param city
070         * @param country
071         * @param deliverypoint
072         * @param electronicmailaddress
073         * @param postalcode
074         */
075        public Address( String administrativearea, String city, String country, String[] deliverypoint,
076                        String[] electronicmailaddress, String postalcode ) {
077    
078            this.deliverypoint = new ArrayList<String>();
079            this.electronicmailaddress = new ArrayList<String>();
080    
081            setAdministrativeArea( administrativearea );
082            setCity( city );
083            setCountry( country );
084            setDeliveryPoint( deliverypoint );
085            setElectronicMailAddress( electronicmailaddress );
086            setPostalCode( postalcode );
087        }
088    
089        /**
090         *
091         * @return Administrative Area
092         */
093        public String getAdministrativeArea() {
094            return administrativearea;
095        }
096    
097        /**
098         * @param administrativearea
099         */
100        public void setAdministrativeArea( String administrativearea ) {
101            this.administrativearea = administrativearea;
102        }
103    
104        /**
105         *
106         * @return city name
107         */
108        public String getCity() {
109            return city;
110        }
111    
112        /**
113         * @see Address#getCity()
114         *
115         * @param city
116         */
117        public void setCity( String city ) {
118            this.city = city;
119        }
120    
121        /**
122         *
123         * @return country name
124         */
125        public String getCountry() {
126            return country;
127        }
128    
129        /**
130         * @see Address#getCountry()
131         *
132         * @param country
133         */
134        public void setCountry( String country ) {
135            this.country = country;
136        }
137    
138        /**
139         * @return Delivery Points
140         */
141        public String[] getDeliveryPoint() {
142            return deliverypoint.toArray( new String[deliverypoint.size()] );
143        }
144    
145        /**
146         * @see Address#getDeliveryPoint()
147         * @param deliverypoint
148         */
149        public void addDeliveryPoint( String deliverypoint ) {
150            this.deliverypoint.add( deliverypoint );
151        }
152    
153        /**
154         * @see Address#getDeliveryPoint()
155         * @param deliverypoint
156         */
157        public void setDeliveryPoint( String[] deliverypoint ) {
158            this.deliverypoint.clear();
159            for ( int i = 0; i < deliverypoint.length; i++ ) {
160                this.deliverypoint.add( deliverypoint[i] );
161            }
162        }
163    
164        /**
165         * @return Electronic Mail Addresses
166         */
167        public String[] getElectronicMailAddress() {
168            return electronicmailaddress.toArray( new String[electronicmailaddress.size()] );
169        }
170    
171        /**
172         * @see Address#getElectronicMailAddress()
173         * @param electronicmailaddress
174         */
175        public void addElectronicMailAddress( String electronicmailaddress ) {
176            this.electronicmailaddress.add( electronicmailaddress );
177        }
178    
179        /**
180         * @see Address#getElectronicMailAddress()
181         * @param electronicmailaddress
182         */
183        public void setElectronicMailAddress( String[] electronicmailaddress ) {
184            this.electronicmailaddress.clear();
185            for ( int i = 0; i < electronicmailaddress.length; i++ ) {
186                this.electronicmailaddress.add( electronicmailaddress[i] );
187            }
188        }
189    
190        /**
191         * @return postal code
192         */
193        public String getPostalCode() {
194            return postalcode;
195        }
196    
197        /**
198         * @see Address#getPostalCode()
199         * @param postalcode
200         */
201        public void setPostalCode( String postalcode ) {
202            this.postalcode = postalcode;
203        }
204    
205        /**
206         * tpString method
207         *
208         * @return string representation
209         */
210        public String toString() {
211            String ret = "administrativearea = " + administrativearea + "\n" + "city = " + city + "\n" + "country = "
212                         + country + "\n" + "deliverypoint = " + deliverypoint + "\n" + "electronicmailaddress = "
213                         + electronicmailaddress + "\n" + "postalcode =" + postalcode + "\n";
214            return ret;
215        }
216    
217    }