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;
028import java.util.Set;
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   * Dataset title/name.
120   */
121  DATASET_TITLE(String.class),
122
123  /**
124   * Collection key associate to this dataset.
125   */
126  COLLECTION_KEY(UUID.class),
127
128  /**
129   * Institution key associated to the dataset and/or to the collection.
130   */
131  INSTITUTION_KEY(UUID.class),
132
133  /**
134   * DOI associated to one more dataset.
135   */
136  DOI(String.class),
137
138  /**
139   * Network key associated to a dataset.
140   */
141  NETWORK_KEY(UUID.class),
142
143  /**
144   * Node key that endorsed this dataset's publisher.
145   */
146  ENDORSING_NODE_KEY(UUID.class),
147
148  /**
149   * Hosting installation key.
150   */
151  INSTALLATION_KEY(UUID.class),
152
153  /**
154   * EndpointType associated to a dataset.
155   */
156  ENDPOINT_TYPE(EndpointType.class),
157
158  /**
159   * Published DwC-A extension.
160   */
161  DWCA_EXTENSION(String.class),
162
163  /**
164   * Published DwC-A row/core type.
165   */
166  DWCA_CORE_TYPE(String.class),
167
168  CONTACT_USER_ID(String.class),
169
170  CONTACT_EMAIL(String.class),
171
172  /**
173   * Category of the dataset.
174   */
175  CATEGORY(String.class);
176
177  DatasetSearchParameter(Class<?> type) {
178    this.type = type;
179  }
180
181  private final Class<?> type;
182
183  /**
184   * @return the data type expected for the value of the respective search parameter
185   */
186  @Override
187  public Class<?> type() {
188    return type;
189  }
190
191}