001package org.gbif.api.model.collections.request; 002 003import java.io.Serializable; 004import java.util.Date; 005import java.util.List; 006import javax.annotation.Nullable; 007import lombok.AllArgsConstructor; 008import lombok.Builder; 009import lombok.Data; 010import lombok.NoArgsConstructor; 011import org.gbif.api.model.common.paging.Pageable; 012import org.gbif.api.model.common.paging.PageableBase; 013import org.gbif.api.model.common.paging.PagingConstants; 014import org.gbif.api.model.common.paging.PagingRequest; 015import org.gbif.api.vocabulary.Country; 016import org.gbif.api.vocabulary.Rank; 017 018@Data 019@NoArgsConstructor 020@AllArgsConstructor 021@Builder 022public class DescriptorSearchRequest extends PageableBase implements Serializable { 023 024 @Nullable private String q; 025 @Nullable private Long descriptorGroupKey; 026 @Nullable private List<Integer> usageKey; 027 @Nullable private List<String> usageName; 028 @Nullable private List<Rank> usageRank; 029 @Nullable private List<Integer> taxonKey; 030 @Nullable private List<Country> country; 031 @Nullable private List<String> individualCount; 032 @Nullable private List<String> identifiedBy; 033 @Nullable private List<String> dateIdentified; 034 @Nullable private List<String> typeStatus; 035 @Nullable private List<String> recordedBy; 036 @Nullable private List<String> discipline; 037 @Nullable private List<String> objectClassification; 038 @Nullable private List<String> issues; 039 040 public Pageable getPage() { 041 return new PagingRequest(getOffset(), getLimit()); 042 } 043 044 public static DescriptorSearchRequestBuilder builder() { 045 return new CustomBuilder(); 046 } 047 048 public static class DescriptorSearchRequestBuilder { 049 long offset = PagingConstants.DEFAULT_PARAM_OFFSET; 050 int limit = PagingConstants.DEFAULT_PARAM_LIMIT; 051 052 public DescriptorSearchRequestBuilder offset(long offset) { 053 this.offset = offset; 054 return this; 055 } 056 057 public DescriptorSearchRequestBuilder limit(int limit) { 058 this.limit = limit; 059 return this; 060 } 061 } 062 063 public static class CustomBuilder extends DescriptorSearchRequestBuilder { 064 065 @Override 066 public DescriptorSearchRequest build() { 067 DescriptorSearchRequest descriptorSearchRequest = super.build(); 068 descriptorSearchRequest.setOffset(offset); 069 descriptorSearchRequest.setLimit(limit); 070 return descriptorSearchRequest; 071 } 072 } 073}