001/* 002 * Copyright 2020 Global Biodiversity Information Facility (GBIF) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.gbif.api.model.registry.search; 017 018import org.gbif.api.model.common.search.SearchParameter; 019import org.gbif.api.vocabulary.Continent; 020import org.gbif.api.vocabulary.Country; 021import org.gbif.api.vocabulary.DatasetSubtype; 022import org.gbif.api.vocabulary.DatasetType; 023import org.gbif.api.vocabulary.EndpointType; 024import org.gbif.api.vocabulary.IdentifierType; 025import org.gbif.api.vocabulary.License; 026 027import java.time.LocalDateTime; 028import java.util.UUID; 029 030/** 031 * Each value in the enum represents a possible facet for the Dataset search. 032 */ 033public enum DatasetSearchParameter implements SearchParameter { 034 035 /** 036 * {@link org.gbif.api.vocabulary.DatasetType} enumeration value. 037 */ 038 TYPE(DatasetType.class), 039 040 /** 041 * {@link org.gbif.api.vocabulary.DatasetSubtype} enumeration value. 042 */ 043 SUBTYPE(DatasetSubtype.class), 044 045 /** 046 * The owning organizations uuid key. 047 */ 048 PUBLISHING_ORG(UUID.class), 049 050 /** 051 * The hosting organization's uuid key. 052 */ 053 HOSTING_ORG(UUID.class), 054 055 /** 056 * A case-insensitive plain text keyword from coverages or serialized tag as created by Tag.toString(). 057 */ 058 KEYWORD(String.class), 059 060 /** 061 * Filters datasets by their temporal coverage broken down to decades. 062 * Decade given as a full year, e.g. 1950, 1960 or 1980. 063 */ 064 DECADE(Integer.class), 065 066 /** 067 * The hosting organization's country. 068 */ 069 PUBLISHING_COUNTRY(Country.class), 070 071 /** 072 * The owning organization's country. 073 */ 074 HOSTING_COUNTRY(Country.class), 075 076 /** 077 * Country of the geospatial coverage of a dataset. 078 */ 079 COUNTRY(Country.class), 080 081 /** 082 * {@link org.gbif.api.vocabulary.Continent} of the geospatial coverage of a dataset. 083 */ 084 CONTINENT(Continent.class), 085 086 /** 087 * {@link org.gbif.api.vocabulary.License} of a dataset. 088 */ 089 LICENSE(License.class), 090 091 /** 092 * Identifier of the associated project. 093 */ 094 PROJECT_ID(String.class), 095 096 /** 097 * Backbone name usage key that this dataset covers. 098 */ 099 TAXON_KEY(Integer.class), 100 101 /** 102 * Number of indexed records. 103 * Depending on type of dataset these are occurrences or name usages. 104 */ 105 RECORD_COUNT(Integer.class), 106 107 /** 108 * Filters datasets by their temporal coverage broken down to years 109 * as extracted from the occurrence data. 110 */ 111 YEAR(Integer.class), 112 113 /** 114 * Date when the dataset was last updated 115 */ 116 MODIFIED_DATE(LocalDateTime.class), 117 118 /** 119 * Date when the dataset was created 120 */ 121 CREATED_DATE(LocalDateTime.class), 122 123 /** 124 * Date when the dataset was published 125 */ 126 PUBLICATION_DATE(LocalDateTime.class), 127 128 /** 129 * Dataset title/name. 130 */ 131 DATASET_TITLE(String.class), 132 133 /** 134 * Collection key associate to this dataset. 135 */ 136 COLLECTION_KEY(UUID.class), 137 138 /** 139 * Institution key associated to the dataset and/or to the collection. 140 */ 141 INSTITUTION_KEY(UUID.class), 142 143 /** 144 * DOI associated to one more dataset. 145 */ 146 DOI(String.class), 147 148 /** 149 * Network key associated to a dataset. 150 */ 151 NETWORK_KEY(UUID.class), 152 153 /** 154 * Node key that endorsed this dataset's publisher. 155 */ 156 ENDORSING_NODE_KEY(UUID.class), 157 158 /** 159 * Hosting installation key. 160 */ 161 INSTALLATION_KEY(UUID.class), 162 163 /** 164 * EndpointType associated to a dataset. 165 */ 166 ENDPOINT_TYPE(EndpointType.class), 167 168 /** 169 * Published DwC-A extension. 170 */ 171 DWCA_EXTENSION(String.class), 172 173 /** 174 * Published DwC-A row/core type. 175 */ 176 DWCA_CORE_TYPE(String.class), 177 178 CONTACT_USER_ID(String.class), 179 180 CONTACT_EMAIL(String.class), 181 182 /** 183 * Category of the dataset. 184 */ 185 CATEGORY(String.class), 186 187 MACHINE_TAG_NAMESPACE(String.class), 188 189 MACHINE_TAG_NAME(String.class), 190 191 MACHINE_TAG_VALUE(String.class), 192 193 IDENTIFIER(String.class), 194 195 IDENTIFIER_TYPE(IdentifierType.class), 196 197 /** 198 * Table/Resource schema of a resource published as part of a DwC-DP dataset. 199 */ 200 DWC_DP_RESOURCE_SCHEMA(String.class); 201 202 DatasetSearchParameter(Class<?> type) { 203 this.type = type; 204 } 205 206 private final Class<?> type; 207 208 /** 209 * @return the data type expected for the value of the respective search parameter 210 */ 211 @Override 212 public Class<?> type() { 213 return type; 214 } 215 216}