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