001/* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014package org.gbif.api.model.checklistbank.search; 015 016import org.gbif.api.model.common.search.SearchParameter; 017import org.gbif.api.vocabulary.Habitat; 018import org.gbif.api.vocabulary.NameType; 019import org.gbif.api.vocabulary.NameUsageIssue; 020import org.gbif.api.vocabulary.NomenclaturalStatus; 021import org.gbif.api.vocabulary.Origin; 022import org.gbif.api.vocabulary.Rank; 023import org.gbif.api.vocabulary.TaxonomicStatus; 024import org.gbif.api.vocabulary.ThreatStatus; 025 026import java.util.UUID; 027 028/** 029 * Each value in the enum represents a search parameter or facet of the name usage search. 030 */ 031public enum NameUsageSearchParameter implements SearchParameter { 032 033 /** 034 * The checklist dataset key as a UUID. 035 */ 036 DATASET_KEY(UUID.class), 037 038 /** 039 * The (sub)dataset constituent key as a UUID. Useful to query larger assembled datasets such as the GBIF Backbone or the Catalogue of Life 040 */ 041 CONSTITUENT_KEY(UUID.class), 042 043 /** 044 * Filters by the rank of the name usage. 045 */ 046 RANK(Rank.class), 047 048 /** 049 * Filters by any of the higher Linnean rank keys. 050 * Note this is within the respective checklist and not searching NUB keys across all checklists. 051 */ 052 HIGHERTAXON_KEY(Integer.class), 053 054 /** 055 * Filter by the taxonomis status. 056 */ 057 STATUS(TaxonomicStatus.class), 058 059 /** 060 * Boolean filter for extinct taxa. 061 */ 062 IS_EXTINCT(Boolean.class), 063 064 /** 065 * Filter by the known habitats. 066 */ 067 HABITAT(Habitat.class), 068 069 /** 070 * Filter by the threat status. 071 */ 072 THREAT(ThreatStatus.class), 073 074 /** 075 * Filter by the nomenclatural status. 076 */ 077 NOMENCLATURAL_STATUS(NomenclaturalStatus.class), 078 079 /** 080 * Filter by the name type. 081 */ 082 NAME_TYPE(NameType.class), 083 084 /** 085 * Searches name usages for those that have a specific issue. 086 */ 087 ISSUE(NameUsageIssue.class), 088 089 /** 090 * Searches name usages for those with a specific origin. 091 */ 092 ORIGIN(Origin.class); 093 094 private NameUsageSearchParameter(Class<?> type) { 095 this.type = type; 096 } 097 098 private final Class<?> type; 099 100 /** 101 * @return the data type expected for the value of the respective search parameter 102 */ 103 @Override 104 public Class<?> type() { 105 return type; 106 } 107}