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