001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/model/metadata/iso19115/CitedResponsibleParty.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.io.Serializable;
049    import java.util.ArrayList;
050    import java.util.Arrays;
051    import java.util.List;
052    
053    /**
054     * CitedResponsibleParty_Impl.java
055     * 
056     * Created on 16. September 2002, 09:55
057     * <p>
058     * ----------------------------------------------------------------------
059     * </p>
060     * 
061     * @author <a href="mailto:schaefer@lat-lon.de">Axel Schaefer</a>
062     * @version $Revision: 9343 $ $Date: 2007-12-27 14:30:32 +0100 (Do, 27 Dez 2007) $ *
063     */
064    public class CitedResponsibleParty implements Serializable {
065    
066        private static final long serialVersionUID = 5912684530267785339L;
067    
068        private List<ContactInfo> contactinfo = null;
069    
070        private List<String> individualname = null;
071    
072        private List<String> organisationname = null;
073    
074        private List<String> positionname = null;
075    
076        private List<RoleCode> rolecode = null;
077    
078        /**
079         * Creates new instance through <code>List</code>s.
080         * 
081         * @param contactInfo
082         * @param individualName
083         * @param organizationName
084         * @param positionName
085         * @param roleCode
086         */
087        public CitedResponsibleParty( List<ContactInfo> contactInfo, List<String> individualName,
088                                      List<String> organizationName, List<String> positionName, List<RoleCode> roleCode ) {
089            contactinfo = contactInfo;
090            individualname = individualName;
091            organisationname = organizationName;
092            positionname = positionName;
093            rolecode = roleCode;
094        }
095    
096        /** Creates a new instance of CitedResponsibleParty_Impl */
097        public CitedResponsibleParty( ContactInfo[] contactinfo, String[] individualname, String[] organisationname,
098                                      String[] positionname, RoleCode[] rolecode ) {
099    
100            this.contactinfo = new ArrayList<ContactInfo>();
101            this.individualname = new ArrayList<String>();
102            this.organisationname = new ArrayList<String>();
103            this.positionname = new ArrayList<String>();
104            this.rolecode = new ArrayList<RoleCode>();
105    
106            setContactInfo( contactinfo );
107            setIndividualName( individualname );
108            setOrganisationName( organisationname );
109            setPositionName( positionname );
110            setRoleCode( rolecode );
111        }
112    
113        /**
114         * @return ContactInfo-Array
115         * 
116         */
117        public ContactInfo[] getContactInfo() {
118            return contactinfo.toArray( new ContactInfo[contactinfo.size()] );
119        }
120    
121        /**
122         * @see CitedResponsibleParty#getContactInfo()
123         */
124        public void addContactInfo( ContactInfo contactinfo ) {
125            this.contactinfo.add( contactinfo );
126        }
127    
128        /**
129         * @see CitedResponsibleParty#getContactInfo()
130         */
131        public void setContactInfo( ContactInfo[] contactinfo ) {
132            this.contactinfo = Arrays.asList( contactinfo );
133        }
134    
135        /**
136         * @return String-Array
137         * 
138         */
139        public String[] getIndividualName() {
140            return individualname.toArray( new String[individualname.size()] );
141        }
142    
143        /**
144         * @see CitedResponsibleParty#getIndividualName()
145         */
146        public void addIndividualName( String individualname ) {
147            this.individualname.add( individualname );
148        }
149    
150        /**
151         * @see CitedResponsibleParty#getIndividualName()
152         */
153        public void setIndividualName( String[] individualname ) {
154            this.individualname = Arrays.asList( individualname );
155        }
156    
157        /**
158         * 
159         * @return String-Array
160         */
161        public String[] getOrganisationName() {
162            return organisationname.toArray( new String[organisationname.size()] );
163        }
164    
165        /**
166         * @see CitedResponsibleParty#getOrganisationName()
167         */
168        public void addOrganisationName( String organisationname ) {
169            this.organisationname.add( organisationname );
170        }
171    
172        /**
173         * @see CitedResponsibleParty#getOrganisationName()
174         */
175        public void setOrganisationName( String[] organisationname ) {
176            this.organisationname = Arrays.asList( organisationname );
177        }
178    
179        /**
180         * @return String-Array
181         * 
182         */
183        public String[] getPositionName() {
184            return positionname.toArray( new String[positionname.size()] );
185        }
186    
187        /**
188         * @see CitedResponsibleParty#getPositionName()
189         */
190        public void addPositionName( String positionname ) {
191            this.positionname.add( positionname );
192        }
193    
194        /**
195         * @see CitedResponsibleParty#getPositionName()
196         */
197        public void setPositionName( String[] positionname ) {
198            this.positionname = Arrays.asList( positionname );
199        }
200    
201        /**
202         * @return RoleCode-Array
203         * 
204         */
205        public RoleCode[] getRoleCode() {
206            return rolecode.toArray( new RoleCode[rolecode.size()] );
207        }
208    
209        /**
210         * @see CitedResponsibleParty#getRoleCode()
211         */
212        public void addRoleCode( RoleCode rolecode ) {
213            this.rolecode.add( rolecode );
214        }
215    
216        /**
217         * @see CitedResponsibleParty#getRoleCode()
218         */
219        public void setRoleCode( RoleCode[] rolecode ) {
220            if ( rolecode != null ) {
221                this.rolecode = Arrays.asList( rolecode );
222            } else
223                this.rolecode.clear();
224        }
225    
226        /**
227         * to String method
228         */
229        @Override
230        public String toString() {
231            String ret = null;
232            ret = "contactinfo = " + contactinfo + "\n";
233            ret += "individualname = " + individualname + "\n";
234            ret += "organisationname = " + organisationname + "\n";
235            ret += "positionname = " + positionname + "\n";
236            ret += "rolecode = " + rolecode + "\n";
237            return ret;
238        }
239    
240    }