001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2004-2024 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.metadata.citation;
019
020import org.opengis.util.CodeList;
021import org.opengis.annotation.UML;
022import org.opengis.geoapi.internal.Vocabulary;
023
024import static org.opengis.annotation.Obligation.*;
025import static org.opengis.annotation.Specification.*;
026
027
028/**
029 * Function performed by the responsible party.
030 *
031 * @author  Martin Desruisseaux (IRD)
032 * @author  Cory Horner (Refractions Research)
033 * @author  Rémi Maréchal (Geomatys)
034 * @version 3.1
035 * @since   2.0
036 */
037@Vocabulary(capacity=20)
038@UML(identifier="CI_RoleCode", specification=ISO_19115)
039public final class Role extends CodeList<Role> {
040    /**
041     * Serial number for compatibility with different versions.
042     */
043    private static final long serialVersionUID = -7763516018565534103L;
044
045    /**
046     * Party that supplies the resource.
047     */
048    @UML(identifier="resourceProvider", obligation=CONDITIONAL, specification=ISO_19115)
049    public static final Role RESOURCE_PROVIDER = new Role("RESOURCE_PROVIDER");
050
051    /**
052     * Party that accepts accountability and responsibility for the data and ensures
053     * appropriate care and maintenance of the resource.
054     */
055    @UML(identifier="custodian", obligation=CONDITIONAL, specification=ISO_19115)
056    public static final Role CUSTODIAN = new Role("CUSTODIAN");
057
058    /**
059     * Party that owns the resource.
060     */
061    @UML(identifier="owner", obligation=CONDITIONAL, specification=ISO_19115)
062    public static final Role OWNER = new Role("OWNER");
063
064    /**
065     * Party who uses the resource.
066     */
067    @UML(identifier="user", obligation=CONDITIONAL, specification=ISO_19115)
068    public static final Role USER = new Role("USER");
069
070    /**
071     * Party who distributes the resource.
072     */
073    @UML(identifier="distributor", obligation=CONDITIONAL, specification=ISO_19115)
074    public static final Role DISTRIBUTOR = new Role("DISTRIBUTOR");
075
076    /**
077     * Party who created the resource.
078     */
079    @UML(identifier="originator", obligation=CONDITIONAL, specification=ISO_19115)
080    public static final Role ORIGINATOR = new Role("ORIGINATOR");
081
082    /**
083     * Party who can be contacted for acquiring knowledge about or acquisition of the resource.
084     */
085    @UML(identifier="pointOfContact", obligation=CONDITIONAL, specification=ISO_19115)
086    public static final Role POINT_OF_CONTACT = new Role("POINT_OF_CONTACT");
087
088    /**
089     * Key party responsible for gathering information and conducting research.
090     */
091    @UML(identifier="principalInvestigator", obligation=CONDITIONAL, specification=ISO_19115)
092    public static final Role PRINCIPAL_INVESTIGATOR = new Role("PRINCIPAL_INVESTIGATOR");
093
094    /**
095     * Party who has processed the data in a manner such that the resource has been modified.
096     */
097    @UML(identifier="processor", obligation=CONDITIONAL, specification=ISO_19115)
098    public static final Role PROCESSOR = new Role("PROCESSOR");
099
100    /**
101     * Party who published the resource.
102     */
103    @UML(identifier="publisher", obligation=CONDITIONAL, specification=ISO_19115)
104    public static final Role PUBLISHER = new Role("PUBLISHER");
105
106    /**
107     * Party who authored the resource.
108     */
109    @UML(identifier="author", obligation=CONDITIONAL, specification=ISO_19115)
110    public static final Role AUTHOR = new Role("AUTHOR");
111
112    /**
113     * Party who speaks for the resource.
114     *
115     * @since 3.1
116     */
117    @UML(identifier="sponsor", obligation=CONDITIONAL, specification=ISO_19115)
118    public static final Role SPONSOR = new Role("SPONSOR");
119
120    /**
121     * Party who jointly authors the resource.
122     *
123     * @since 3.1
124     */
125    @UML(identifier="coAuthor", obligation=CONDITIONAL, specification=ISO_19115)
126    public static final Role CO_AUTHOR = new Role("CO_AUTHOR");
127
128    /**
129     * Party who assists with the generation of the resource other than the principal investigator.
130     *
131     * @since 3.1
132     */
133    @UML(identifier="collaborator", obligation=CONDITIONAL, specification=ISO_19115)
134    public static final Role COLLABORATOR = new Role("COLLABORATOR");
135
136    /**
137     * Party who reviewed or modified the resource to improve the content.
138     *
139     * @since 3.1
140     */
141    @UML(identifier="editor", obligation=CONDITIONAL, specification=ISO_19115)
142    public static final Role EDITOR = new Role("EDITOR");
143
144    /**
145     * A class of entity that immediate access to the resource and for whom the resource is intended or useful.
146     *
147     * @since 3.1
148     */
149    @UML(identifier="mediator", obligation=CONDITIONAL, specification=ISO_19115)
150    public static final Role MEDIATOR = new Role("MEDIATOR");
151
152    /**
153     * Party owning or managing rights over the resource.
154     *
155     * @since 3.1
156     */
157    @UML(identifier="rightsHolder", obligation=CONDITIONAL, specification=ISO_19115)
158    public static final Role RIGHTS_HOLDER = new Role("RIGHTS_HOLDER");
159
160    /**
161     * Party contributing to the resource.
162     *
163     * @since 3.1
164     */
165    @UML(identifier="contributor", obligation=CONDITIONAL, specification=ISO_19115)
166    public static final Role CONTRIBUTOR = new Role("CONTRIBUTOR");
167
168    /**
169     * Party providing monetary support for the resource.
170     *
171     * @since 3.1
172     */
173    @UML(identifier="funder", obligation=CONDITIONAL, specification=ISO_19115)
174    public static final Role FUNDER = new Role("FUNDER");
175
176    /**
177     * Party who has an interest in the resource or the use of the resource.
178     *
179     * @since 3.1
180     */
181    @UML(identifier="stakeholder", obligation=CONDITIONAL, specification=ISO_19115)
182    public static final Role STAKEHOLDER = new Role("STAKEHOLDER");
183
184    /**
185     * Constructs an element of the given name.
186     *
187     * @param name  the name of the new element. This name shall not be in use by another element of this type.
188     */
189    private Role(final String name) {
190        super(name);
191    }
192
193    /**
194     * Returns the list of {@code Role}s.
195     *
196     * @return the list of codes declared in the current JVM.
197     */
198    public static Role[] values() {
199        return values(Role.class);
200    }
201
202    /**
203     * Returns the list of codes of the same kind as this code list element.
204     * Invoking this method is equivalent to invoking {@link #values()}, except that
205     * this method can be invoked on an instance of the parent {@code CodeList} class.
206     *
207     * @return all code {@linkplain #values() values} for this code list.
208     */
209    @Override
210    public Role[] family() {
211        return values();
212    }
213
214    /**
215     * Returns the role that matches the given string, or returns a new one if none match it.
216     * This methods returns the first instance (in declaration order) for which the {@linkplain #name() name}
217     * is {@linkplain String#equalsIgnoreCase(String) equals, ignoring case}, to the given name.
218     * If no existing instance is found, then a new one is created for the given name.
219     *
220     * @param  code  the name of the code to fetch or to create.
221     * @return a code matching the given name.
222     */
223    public static Role valueOf(String code) {
224        return valueOf(Role.class, code, Role::new).get();
225    }
226}