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