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.checklistbank.search;
017
018
019import org.gbif.api.model.common.search.SearchParameter;
020import org.gbif.api.vocabulary.*;
021
022import java.util.UUID;
023
024/**
025 * Each value in the enum represents a search parameter or facet of the name usage search.
026 */
027public enum NameUsageSearchParameter implements SearchParameter {
028
029  /**
030   * The checklist dataset key as a uuid.
031   */
032  DATASET_KEY(UUID.class),
033
034  /**
035   * The (sub)dataset constituent key as a uuid. Useful to query larger assembled datasets such as the GBIF Backbone or the Catalogue of Life
036   */
037  CONSTITUENT_KEY(UUID.class),
038
039  /**
040   * Filters by the rank of the name usage.
041   */
042  RANK(Rank.class),
043
044  /**
045   * Filters by any of the higher linnean rank keys.
046   * Note this is within the respective checklist and not searching nunb keys across all checklists.
047   */
048  HIGHERTAXON_KEY(Integer.class),
049
050  /**
051   * Filter by the taxonomis status.
052   */
053  STATUS(TaxonomicStatus.class),
054
055  /**
056   * Boolean filter for extinct taxa.
057   */
058  IS_EXTINCT(Boolean.class),
059
060  /**
061   * Filter by the known habitats.
062   */
063  HABITAT(Habitat.class),
064
065  /**
066   * Filter by the threat status.
067   */
068  THREAT(ThreatStatus.class),
069
070  /**
071   * Filter by the nomenclatural status.
072   */
073  NOMENCLATURAL_STATUS(NomenclaturalStatus.class),
074
075  /**
076   * Filter by the name type.
077   */
078  NAME_TYPE(NameType.class),
079
080  /**
081   * Searches name usages for those that have a specific issue.
082   */
083  ISSUE(NameUsageIssue.class),
084
085  /**
086   * Searches name usages for those with a specific origin.
087   */
088  ORIGIN(Origin.class);
089
090  private NameUsageSearchParameter(Class<?> type) {
091    this.type = type;
092  }
093
094  private final Class<?> type;
095
096  /**
097   * @return the data type expected for the value of the respective search parameter
098   */
099  public Class<?> type() {
100    return type;
101  }
102}