001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/model/metadata/iso19115/Address.java $
002    /*
003     ----------------    FILE HEADER  ------------------------------------------
004     
005     This file is part of deegree.
006     Copyright (C) 2001-2008 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: 9343 $, $Date: 2007-12-27 14:30:32 +0100 (Do, 27 Dez 2007) $
058     */
059    public class Address {
060    
061        private String administrativearea = null;
062    
063        private String city = null;
064    
065        private String country = null;
066    
067        private ArrayList<String> deliverypoint = null;
068    
069        private ArrayList<String> electronicmailaddress = null;
070    
071        private String postalcode = null;
072    
073        /**
074         * Address
075         * 
076         * @param administrativearea
077         * @param city
078         * @param country
079         * @param deliverypoint
080         * @param electronicmailaddress
081         * @param postalcode
082         */
083        public Address( String administrativearea, String city, String country, String[] deliverypoint,
084                        String[] electronicmailaddress, String postalcode ) {
085    
086            this.deliverypoint = new ArrayList<String>();
087            this.electronicmailaddress = new ArrayList<String>();
088    
089            setAdministrativeArea( administrativearea );
090            setCity( city );
091            setCountry( country );
092            setDeliveryPoint( deliverypoint );
093            setElectronicMailAddress( electronicmailaddress );
094            setPostalCode( postalcode );
095        }
096    
097        /**
098         * 
099         * @return Administrative Area
100         */
101        public String getAdministrativeArea() {
102            return administrativearea;
103        }
104    
105        /**
106         * @param administrativearea
107         */
108        public void setAdministrativeArea( String administrativearea ) {
109            this.administrativearea = administrativearea;
110        }
111    
112        /**
113         * 
114         * @return city name
115         */
116        public String getCity() {
117            return city;
118        }
119    
120        /**
121         * @see Address#getCity()
122         * 
123         * @param city
124         */
125        public void setCity( String city ) {
126            this.city = city;
127        }
128    
129        /**
130         * 
131         * @return country name
132         */
133        public String getCountry() {
134            return country;
135        }
136    
137        /**
138         * @see Address#getCountry()
139         * 
140         * @param country
141         */
142        public void setCountry( String country ) {
143            this.country = country;
144        }
145    
146        /**
147         * @return Delivery Points
148         */
149        public String[] getDeliveryPoint() {
150            return deliverypoint.toArray( new String[deliverypoint.size()] );
151        }
152    
153        /**
154         * @see Address#getDeliveryPoint()
155         * @param deliverypoint
156         */
157        public void addDeliveryPoint( String deliverypoint ) {
158            this.deliverypoint.add( deliverypoint );
159        }
160    
161        /**
162         * @see Address#getDeliveryPoint()
163         * @param deliverypoint
164         */
165        public void setDeliveryPoint( String[] deliverypoint ) {
166            this.deliverypoint.clear();
167            for ( int i = 0; i < deliverypoint.length; i++ ) {
168                this.deliverypoint.add( deliverypoint[i] );
169            }
170        }
171    
172        /**
173         * @return Electronic Mail Addresses
174         */
175        public String[] getElectronicMailAddress() {
176            return electronicmailaddress.toArray( new String[electronicmailaddress.size()] );
177        }
178    
179        /**
180         * @see Address#getElectronicMailAddress()
181         * @param electronicmailaddress
182         */
183        public void addElectronicMailAddress( String electronicmailaddress ) {
184            this.electronicmailaddress.add( electronicmailaddress );
185        }
186    
187        /**
188         * @see Address#getElectronicMailAddress()
189         * @param electronicmailaddress
190         */
191        public void setElectronicMailAddress( String[] electronicmailaddress ) {
192            this.electronicmailaddress.clear();
193            for ( int i = 0; i < electronicmailaddress.length; i++ ) {
194                this.electronicmailaddress.add( electronicmailaddress[i] );
195            }
196        }
197    
198        /**
199         * @return postal code
200         */
201        public String getPostalCode() {
202            return postalcode;
203        }
204    
205        /**
206         * @see Address#getPostalCode()
207         * @param postalcode
208         */
209        public void setPostalCode( String postalcode ) {
210            this.postalcode = postalcode;
211        }
212    
213        /**
214         * tpString method
215         * 
216         * @return string representation
217         */
218        public String toString() {
219            String ret = "administrativearea = " + administrativearea + "\n" + "city = " + city + "\n" + "country = "
220                         + country + "\n" + "deliverypoint = " + deliverypoint + "\n" + "electronicmailaddress = "
221                         + electronicmailaddress + "\n" + "postalcode =" + postalcode + "\n";
222            return ret;
223        }
224    
225    }