001/*
002 * Copyright 2014 Global Biodiversity Information Facility (GBIF)
003 * Licensed under the Apache License, Version 2.0 (the "License");
004 * you may not use this file except in compliance with the License.
005 * You may obtain a copy of the License at
006 * http://www.apache.org/licenses/LICENSE-2.0
007 * Unless required by applicable law or agreed to in writing, software
008 * distributed under the License is distributed on an "AS IS" BASIS,
009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010 * See the License for the specific language governing permissions and
011 * limitations under the License.
012 */
013package org.gbif.api.model.occurrence.search;
014
015import org.gbif.api.model.common.paging.Pageable;
016import org.gbif.api.model.common.search.FacetedSearchRequest;
017import org.gbif.api.vocabulary.BasisOfRecord;
018import org.gbif.api.vocabulary.Continent;
019import org.gbif.api.vocabulary.Country;
020import org.gbif.api.vocabulary.EstablishmentMeans;
021import org.gbif.api.vocabulary.MediaType;
022import org.gbif.api.vocabulary.OccurrenceIssue;
023import org.gbif.api.vocabulary.TypeStatus;
024
025import java.util.Date;
026import java.util.UUID;
027
028
029/**
030 * Request class for issuing search request to the occurrence search service.
031 */
032public class OccurrenceSearchRequest extends FacetedSearchRequest<OccurrenceSearchParameter> {
033
034  public OccurrenceSearchRequest() {
035    // empty block
036    super();
037  }
038
039  public OccurrenceSearchRequest(long offset, int limit) {
040    super(offset, limit);
041  }
042
043  public OccurrenceSearchRequest(Pageable page) {
044    super(page);
045  }
046
047  public void addOccurrenceIDFilter(String occurrenceID) {
048    addParameter(OccurrenceSearchParameter.OCCURRENCE_ID, occurrenceID);
049  }
050
051  public void addEstablishmentMeansFilter(EstablishmentMeans establishmentMeans) {
052    addParameter(OccurrenceSearchParameter.ESTABLISHMENT_MEANS, establishmentMeans);
053  }
054
055  public void addBasisOfRecordFilter(BasisOfRecord basisOfRecord) {
056    addParameter(OccurrenceSearchParameter.BASIS_OF_RECORD, basisOfRecord);
057  }
058
059  public void addTypeStatusFilter(TypeStatus typeStatus) {
060    addParameter(OccurrenceSearchParameter.TYPE_STATUS, typeStatus);
061  }
062
063  public void addCatalogNumberFilter(String catalogNumber) {
064    addParameter(OccurrenceSearchParameter.CATALOG_NUMBER, catalogNumber);
065  }
066
067  public void addRecordedByFilter(String collectorName) {
068    addParameter(OccurrenceSearchParameter.RECORDED_BY, collectorName);
069  }
070
071  public void addRecordNumberFilter(String recordNumber) {
072    addParameter(OccurrenceSearchParameter.RECORD_NUMBER, recordNumber);
073  }
074
075  public void addCountryFilter(Country country) {
076    addParameter(OccurrenceSearchParameter.COUNTRY, country);
077  }
078
079  public void addContinentFilter(Continent continent) {
080    addParameter(OccurrenceSearchParameter.CONTINENT, continent);
081  }
082
083  public void addDatasetKeyFilter(UUID datasetKey) {
084    addParameter(OccurrenceSearchParameter.DATASET_KEY, datasetKey.toString());
085  }
086
087  public void addGeometryFilter(String geometryAsWkt) {
088    addParameter(OccurrenceSearchParameter.GEOMETRY, geometryAsWkt);
089  }
090
091  public void addDecimalLatitudeFilter(double latitude) {
092    addParameter(OccurrenceSearchParameter.DECIMAL_LATITUDE, latitude);
093  }
094
095  public void addDecimalLongitudeFilter(double longitude) {
096    addParameter(OccurrenceSearchParameter.DECIMAL_LONGITUDE, longitude);
097  }
098
099  public void addMonthFilter(int month) {
100    addParameter(OccurrenceSearchParameter.MONTH, month);
101  }
102
103  public void addTaxonKeyFilter(int taxonKey) {
104    addParameter(OccurrenceSearchParameter.TAXON_KEY, taxonKey);
105  }
106
107  public void addKingdomKeyFilter(int kingdomKey) {
108    addParameter(OccurrenceSearchParameter.KINGDOM_KEY, kingdomKey);
109  }
110
111  public void addPhylumKeyFilter(int phylumKey) {
112    addParameter(OccurrenceSearchParameter.PHYLUM_KEY, phylumKey);
113  }
114
115  public void addClassKeyFilter(int classKey) {
116    addParameter(OccurrenceSearchParameter.CLASS_KEY, classKey);
117  }
118
119  public void addOrderKeyFilter(int orderKey) {
120    addParameter(OccurrenceSearchParameter.ORDER_KEY, orderKey);
121  }
122
123  public void addFamilyKeyFilter(int familyKey) {
124    addParameter(OccurrenceSearchParameter.FAMILY_KEY, familyKey);
125  }
126
127  public void addGenusKeyFilter(int genusKey) {
128    addParameter(OccurrenceSearchParameter.GENUS_KEY, genusKey);
129  }
130
131  public void addSubGenusKeyFilter(int subGenusKey) {
132    addParameter(OccurrenceSearchParameter.SUBGENUS_KEY, subGenusKey);
133  }
134
135  public void addSpeciesKeyFilter(int speciesKey) {
136    addParameter(OccurrenceSearchParameter.SPECIES_KEY, speciesKey);
137  }
138
139  public void addYearFilter(int year) {
140    addParameter(OccurrenceSearchParameter.YEAR, year);
141  }
142
143  public void addEventDateFilter(Date date) {
144    addParameter(OccurrenceSearchParameter.EVENT_DATE, date);
145  }
146
147  public void addLastInterpretedFilter(Date modified) {
148    addParameter(OccurrenceSearchParameter.LAST_INTERPRETED, modified);
149  }
150
151  public void addPublishingCountryFilter(Country country) {
152    addParameter(OccurrenceSearchParameter.PUBLISHING_COUNTRY, country);
153  }
154
155  public void addInstitutionCodeFilter(String code) {
156    addParameter(OccurrenceSearchParameter.INSTITUTION_CODE, code);
157  }
158
159  public void addHasCoordinateFilter(boolean hasCoordinate) {
160    addParameter(OccurrenceSearchParameter.HAS_COORDINATE, hasCoordinate);
161  }
162
163  public void addSpatialIssueFilter(boolean hasSpatialIssue) {
164    addParameter(OccurrenceSearchParameter.HAS_GEOSPATIAL_ISSUE, hasSpatialIssue);
165  }
166
167  public void addIssueFilter(OccurrenceIssue issue) {
168    addParameter(OccurrenceSearchParameter.ISSUE, issue);
169  }
170
171  public void addElevationFilter(int elevation) {
172    addParameter(OccurrenceSearchParameter.ELEVATION, elevation);
173  }
174
175  public void addMediaTypeFilter(MediaType mediaType) {
176    addParameter(OccurrenceSearchParameter.MEDIA_TYPE, mediaType);
177  }
178
179}