001/* 002 * GeoAPI - Java interfaces for OGC/ISO standards 003 * Copyright © 2006-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.identification; 019 020import org.opengis.util.CodeList; 021import org.opengis.annotation.UML; 022import org.opengis.geoapi.internal.Vocabulary; 023 024import static org.opengis.annotation.Obligation.CONDITIONAL; 025import static org.opengis.annotation.Specification.ISO_19115; 026 027 028/** 029 * Justification for the correlation of two datasets. 030 * 031 * @author Ely Conn (Leica Geosystems Geospatial Imaging, LLC) 032 * @author Rémi Maréchal (Geomatys) 033 * @version 3.1 034 * @since 2.1 035 */ 036@Vocabulary(capacity=10) 037@UML(identifier="DS_AssociationTypeCode", specification=ISO_19115) 038public final class AssociationType extends CodeList<AssociationType> { 039 /** 040 * Serial number for compatibility with different versions. 041 */ 042 private static final long serialVersionUID = 6031427859661710114L; 043 044 /** 045 * Reference from one dataset to another. 046 */ 047 @UML(identifier="crossReference", obligation=CONDITIONAL, specification=ISO_19115) 048 public static final AssociationType CROSS_REFERENCE = new AssociationType("CROSS_REFERENCE"); 049 050 /** 051 * Reference to a master dataset of which this one is a part. 052 * 053 * @since 3.1 054 */ 055 @UML(identifier="largerWorkCitation", obligation=CONDITIONAL, specification=ISO_19115) 056 public static final AssociationType LARGER_WORK_CITATION = new AssociationType("LARGER_WORK_CITATION"); 057 058 /** 059 * @deprecated Renamed <code>LARGER_WOR<b><u>K</u></b>_CITATION</code>. 060 */ 061 @Deprecated(since="3.1") 062 public static final AssociationType LARGER_WORD_CITATION = LARGER_WORK_CITATION; 063 064 /** 065 * Part of same structured set of data held in a computer. 066 */ 067 @UML(identifier="partOfSeamlessDatabase", obligation=CONDITIONAL, specification=ISO_19115) 068 public static final AssociationType PART_OF_SEAMLESS_DATABASE = new AssociationType("PART_OF_SEAMLESS_DATABASE"); 069 070 /** 071 * Mapping and charting information from which the dataset content originates. 072 * 073 * @deprecated Removed in ISO 19115:2014. 074 */ 075 @Deprecated(since="3.1") 076 @UML(identifier="source", obligation=CONDITIONAL, specification=ISO_19115, version=2003) 077 public static final AssociationType SOURCE = new AssociationType("SOURCE"); 078 079 /** 080 * Part of a set of imagery that when used together, provides three-dimensional images. 081 */ 082 @UML(identifier="stereoMate", obligation=CONDITIONAL, specification=ISO_19115) 083 public static final AssociationType STEREO_MATE = new AssociationType("STEREO_MATE"); 084 085 /** 086 * Reference to resources that are parts of this resource. 087 * 088 * @since 3.1 089 */ 090 @UML(identifier="isComposedOf", obligation=CONDITIONAL, specification=ISO_19115) 091 public static final AssociationType IS_COMPOSED_OF = new AssociationType("IS_COMPOSED_OF"); 092 093 /** 094 * Common title for a collection of resources. 095 * 096 * <div class="note"><b>Note:</b> 097 * title identifies elements of a series collectively, 098 * combined with information about what volumes are available at the source cite.</div> 099 * 100 * @since 3.1 101 */ 102 @UML(identifier="collectiveTitle", obligation=CONDITIONAL, specification=ISO_19115) 103 public static final AssociationType COLLECTIVE_TITLE = new AssociationType("COLLECTIVE_TITLE"); 104 105 /** 106 * Associated through a common heritage such as produced to a common product specification. 107 * 108 * @since 3.1 109 */ 110 @UML(identifier="series", obligation=CONDITIONAL, specification=ISO_19115) 111 public static final AssociationType SERIES = new AssociationType("SERIES"); 112 113 /** 114 * Associated through a dependency. 115 * 116 * @since 3.1 117 */ 118 @UML(identifier="dependency", obligation=CONDITIONAL, specification=ISO_19115) 119 public static final AssociationType DEPENDENCY = new AssociationType("DEPENDENCY"); 120 121 /** 122 * Resource is a revision of associated resource. 123 * 124 * @since 3.1 125 */ 126 @UML(identifier="revisionOf", obligation=CONDITIONAL, specification=ISO_19115) 127 public static final AssociationType REVISION_OF = new AssociationType("REVISION_OF"); 128 129 /** 130 * Constructs an element of the given name. 131 * 132 * @param name the name of the new element. This name shall not be in use by another element of this type. 133 */ 134 private AssociationType(final String name) { 135 super(name); 136 } 137 138 /** 139 * Returns the list of {@code AssociationType}s. 140 * 141 * @return the list of codes declared in the current JVM. 142 */ 143 public static AssociationType[] values() { 144 return values(AssociationType.class); 145 } 146 147 /** 148 * Returns the list of codes of the same kind as this code list element. 149 * Invoking this method is equivalent to invoking {@link #values()}, except that 150 * this method can be invoked on an instance of the parent {@code CodeList} class. 151 * 152 * @return all code {@linkplain #values() values} for this code list. 153 */ 154 @Override 155 public AssociationType[] family() { 156 return values(); 157 } 158 159 /** 160 * Returns the association type that matches the given string, or returns a new one if none match it. 161 * This methods returns the first instance (in declaration order) for which the {@linkplain #name() name} 162 * is {@linkplain String#equalsIgnoreCase(String) equals, ignoring case}, to the given name. 163 * If no existing instance is found, then a new one is created for the given name. 164 * 165 * @param code the name of the code to fetch or to create. 166 * @return a code matching the given name. 167 */ 168 public static AssociationType valueOf(String code) { 169 return valueOf(AssociationType.class, code, AssociationType::new).get(); 170 } 171}