001/*
002 * Copyright 2014 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.Country;
020import org.gbif.api.vocabulary.Continent;
021import org.gbif.api.vocabulary.DatasetSubtype;
022import org.gbif.api.vocabulary.DatasetType;
023import org.gbif.api.vocabulary.License;
024
025import java.time.LocalDateTime;
026import java.util.UUID;
027
028/**
029 * Each value in the enum represents a possible facet for the Dataset search.
030 */
031public enum DatasetSearchParameter implements SearchParameter {
032
033  /**
034   * {@link org.gbif.api.vocabulary.DatasetType} enumeration value.
035   */
036  TYPE(DatasetType.class),
037
038  /**
039   * {@link org.gbif.api.vocabulary.DatasetSubtype} enumeration value.
040   */
041  SUBTYPE(DatasetSubtype.class),
042
043  /**
044   * The owning organizations uuid key.
045   */
046  PUBLISHING_ORG(UUID.class),
047
048  /**
049   * The hosting organizations uuid key.
050   */
051  HOSTING_ORG(UUID.class),
052
053  /**
054   * A case insensitive plain text keyword from coverages or serialized tag as created by Tag.toString().
055   */
056  KEYWORD(String.class),
057
058  /**
059   * Filters datasets by their temporal coverage broken down to decades.
060   * Decade given as a full year, e.g. 1950, 1960 or 1980.
061   */
062  DECADE(Integer.class),
063
064  /**
065   * The owning organizations country.
066   */
067  PUBLISHING_COUNTRY(Country.class),
068
069  /**
070   * Country of the geospatial coverage of a dataset.
071   */
072  COUNTRY(Country.class),
073
074  /**
075   * {@link org.gbif.api.vocabulary.Continent} of the geospatial coverage of a dataset.
076   */
077  CONTINENT(Continent.class),
078
079  /**
080   * {@link org.gbif.api.vocabulary.License} of a dataset.
081   */
082  LICENSE(License.class),
083
084  /**
085   * Identifier of the associated project.
086   */
087  PROJECT_ID(String.class),
088
089  /**
090   * Backbone name usage key that this dataset covers.
091   */
092  TAXON_KEY(Integer.class),
093
094  /**
095   * Number of indexed records.
096   * Depending on type of dataset these are occurrences or name usages.
097   */
098  RECORD_COUNT(Integer.class),
099
100  /**
101   * Filters datasets by their temporal coverage broken down to years
102   * as extracted from the occurrence data.
103   */
104  YEAR(Integer.class),
105
106  /**
107   * Date when the dataset was last updated
108   */
109  MODIFIED_DATE(LocalDateTime.class);
110
111  private DatasetSearchParameter(Class<?> type) {
112    this.type = type;
113  }
114
115  private final Class<?> type;
116
117  /**
118   * @return the data type expected for the value of the respective search parameter
119   */
120  public Class<?> type() {
121    return type;
122  }
123
124}