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.License; 025 026import java.time.LocalDateTime; 027import java.util.UUID; 028 029/** 030 * Each value in the enum represents a possible facet for the Dataset search. 031 */ 032public enum DatasetSearchParameter implements SearchParameter { 033 034 /** 035 * {@link org.gbif.api.vocabulary.DatasetType} enumeration value. 036 */ 037 TYPE(DatasetType.class), 038 039 /** 040 * {@link org.gbif.api.vocabulary.DatasetSubtype} enumeration value. 041 */ 042 SUBTYPE(DatasetSubtype.class), 043 044 /** 045 * The owning organizations uuid key. 046 */ 047 PUBLISHING_ORG(UUID.class), 048 049 /** 050 * The hosting organization's uuid key. 051 */ 052 HOSTING_ORG(UUID.class), 053 054 /** 055 * A case insensitive plain text keyword from coverages or serialized tag as created by Tag.toString(). 056 */ 057 KEYWORD(String.class), 058 059 /** 060 * Filters datasets by their temporal coverage broken down to decades. 061 * Decade given as a full year, e.g. 1950, 1960 or 1980. 062 */ 063 DECADE(Integer.class), 064 065 /** 066 * The hosting organization's country. 067 */ 068 PUBLISHING_COUNTRY(Country.class), 069 070 /** 071 * The owning organization's country. 072 */ 073 HOSTING_COUNTRY(Country.class), 074 075 /** 076 * Country of the geospatial coverage of a dataset. 077 */ 078 COUNTRY(Country.class), 079 080 /** 081 * {@link org.gbif.api.vocabulary.Continent} of the geospatial coverage of a dataset. 082 */ 083 CONTINENT(Continent.class), 084 085 /** 086 * {@link org.gbif.api.vocabulary.License} of a dataset. 087 */ 088 LICENSE(License.class), 089 090 /** 091 * Identifier of the associated project. 092 */ 093 PROJECT_ID(String.class), 094 095 /** 096 * Backbone name usage key that this dataset covers. 097 */ 098 TAXON_KEY(Integer.class), 099 100 /** 101 * Number of indexed records. 102 * Depending on type of dataset these are occurrences or name usages. 103 */ 104 RECORD_COUNT(Integer.class), 105 106 /** 107 * Filters datasets by their temporal coverage broken down to years 108 * as extracted from the occurrence data. 109 */ 110 YEAR(Integer.class), 111 112 /** 113 * Date when the dataset was last updated 114 */ 115 MODIFIED_DATE(LocalDateTime.class), 116 117 /** 118 * Dataset title/name. 119 */ 120 DATASET_TITLE(String.class), 121 122 /** 123 * Collection key associate to this dataset. 124 */ 125 COLLECTION_KEY(UUID.class), 126 127 /** 128 * Institution key associated to the dataset and/or to the collection. 129 */ 130 INSTITUTION_KEY(UUID.class), 131 132 /** 133 * DOI associated to one more dataset. 134 */ 135 DOI(String.class), 136 137 /** 138 * Network key associated to a dataset. 139 */ 140 NETWORK_KEY(UUID.class), 141 142 /** 143 * Node key that endorsed this dataset's publisher. 144 */ 145 ENDORSING_NODE_KEY(UUID.class), 146 147 /** 148 * Hosting installation key. 149 */ 150 INSTALLATION_KEY(UUID.class), 151 152 /** 153 * EndpointType associated to a dataset. 154 */ 155 ENDPOINT_TYPE(EndpointType.class); 156 157 DatasetSearchParameter(Class<?> type) { 158 this.type = type; 159 } 160 161 private final Class<?> type; 162 163 /** 164 * @return the data type expected for the value of the respective search parameter 165 */ 166 @Override 167 public Class<?> type() { 168 return type; 169 } 170 171}