001package org.gbif.api.model.registry.search;
002
003import org.gbif.api.vocabulary.Continent;
004import org.gbif.api.vocabulary.Country;
005import org.gbif.api.vocabulary.DatasetSubtype;
006import org.gbif.api.vocabulary.DatasetType;
007import org.gbif.api.vocabulary.License;
008
009import java.util.List;
010import java.util.Set;
011import java.util.UUID;
012
013import com.google.common.base.Objects;
014
015/**
016 * The dataset search model object for faceted and full text search.
017 */
018public class DatasetSearchResult {
019
020  private UUID key;
021  private String title;
022  private String description;
023  private DatasetType type;
024  private DatasetSubtype subtype;
025  private String fullText;
026  private UUID hostingOrganizationKey;
027  private String hostingOrganizationTitle;
028  private String publisherTitle;
029  private Set<Country> countryCoverage;
030  private Set<Continent> continent;
031  private Country publishingCountry;
032  private UUID publishingOrganizationKey;
033  private String publishingOrganizationTitle;
034  private License license;
035  private List<Integer> decades;
036  private List<String> keywords;
037  private String projectIdentifier;
038  private Integer recordCount;
039
040  public UUID getKey() {
041    return key;
042  }
043
044  public void setKey(UUID key) {
045    this.key = key;
046  }
047
048  public String getTitle() {
049    return title;
050  }
051
052  public void setTitle(String title) {
053    this.title = title;
054  }
055
056  public String getDescription() {
057    return description;
058  }
059
060  public void setDescription(String description) {
061    this.description = description;
062  }
063
064  public DatasetType getType() {
065    return type;
066  }
067
068  public void setType(DatasetType type) {
069    this.type = type;
070  }
071
072  public DatasetSubtype getSubtype() {
073    return subtype;
074  }
075
076  public void setSubtype(DatasetSubtype subtype) {
077    this.subtype = subtype;
078  }
079
080  public String getFullText() {
081    return fullText;
082  }
083
084  public void setFullText(String fullText) {
085    this.fullText = fullText;
086  }
087
088  public UUID getHostingOrganizationKey() {
089    return hostingOrganizationKey;
090  }
091
092  public void setHostingOrganizationKey(UUID hostingOrganizationKey) {
093    this.hostingOrganizationKey = hostingOrganizationKey;
094  }
095
096  public String getHostingOrganizationTitle() {
097    return hostingOrganizationTitle;
098  }
099
100  public void setHostingOrganizationTitle(String hostingOrganizationTitle) {
101    this.hostingOrganizationTitle = hostingOrganizationTitle;
102  }
103
104  public String getPublisherTitle() {
105    return publisherTitle;
106  }
107
108  public void setPublisherTitle(String publisherTitle) {
109    this.publisherTitle = publisherTitle;
110  }
111
112  /**
113   * Currently not populated.
114   * TODO: http://dev.gbif.org/issues/browse/REG-393
115   */
116  public Set<Country> getCountryCoverage() {
117    return countryCoverage;
118  }
119
120  public void setCountryCoverage(Set<Country> countryCoverage) {
121    this.countryCoverage = countryCoverage;
122  }
123
124  /**
125   * Currently not populated.
126   * TODO: http://dev.gbif.org/issues/browse/REG-393
127   */
128  public Set<Continent> getContinent() {
129    return continent;
130  }
131
132  public void setContinent(Set<Continent> continent) {
133    this.continent = continent;
134  }
135
136  public Country getPublishingCountry() {
137    return publishingCountry;
138  }
139
140  public void setPublishingCountry(Country publishingCountry) {
141    this.publishingCountry = publishingCountry;
142  }
143
144  public UUID getPublishingOrganizationKey() {
145    return publishingOrganizationKey;
146  }
147
148  public void setPublishingOrganizationKey(UUID publishingOrganizationKey) {
149    this.publishingOrganizationKey = publishingOrganizationKey;
150  }
151
152  public String getPublishingOrganizationTitle() {
153    return publishingOrganizationTitle;
154  }
155
156  public void setPublishingOrganizationTitle(String publishingOrganizationTitle) {
157    this.publishingOrganizationTitle = publishingOrganizationTitle;
158  }
159
160  public License getLicense() {
161    return license;
162  }
163
164  public void setLicense(License license) {
165    this.license = license;
166  }
167
168  public List<Integer> getDecades() {
169    return decades;
170  }
171
172  public void setDecades(List<Integer> decades) {
173    this.decades = decades;
174  }
175
176  public List<String> getKeywords() {
177    return keywords;
178  }
179
180  public void setKeywords(List<String> keywords) {
181    this.keywords = keywords;
182  }
183
184  public String getProjectIdentifier() {
185    return projectIdentifier;
186  }
187
188  public void setProjectIdentifier(String projectIdentifier) {
189    this.projectIdentifier = projectIdentifier;
190  }
191
192  public Integer getRecordCount() {
193    return recordCount;
194  }
195
196  public void setRecordCount(Integer recordCount) {
197    this.recordCount = recordCount;
198  }
199
200  @Override
201  public int hashCode() {
202    return Objects
203      .hashCode(key, title, description, type, subtype, fullText, hostingOrganizationKey, hostingOrganizationTitle,
204        publisherTitle, countryCoverage, continent, publishingCountry, publishingOrganizationKey, publishingOrganizationTitle,
205        decades, keywords, license, projectIdentifier, recordCount);
206  }
207
208  @Override
209  public boolean equals(Object object) {
210    if (object instanceof DatasetSearchResult) {
211      DatasetSearchResult that = (DatasetSearchResult) object;
212      return Objects.equal(this.key, that.key)
213        && Objects.equal(this.title, that.title)
214        && Objects.equal(this.description, that.description)
215        && Objects.equal(this.type, that.type)
216        && Objects.equal(this.subtype, that.subtype)
217        && Objects.equal(this.fullText, that.fullText)
218        && Objects.equal(this.hostingOrganizationKey, that.hostingOrganizationKey)
219        && Objects.equal(this.hostingOrganizationTitle, that.hostingOrganizationTitle)
220        && Objects.equal(this.publisherTitle, that.publisherTitle)
221        && Objects.equal(this.countryCoverage, that.countryCoverage)
222        && Objects.equal(this.continent, that.continent)
223        && Objects.equal(this.publishingCountry, that.publishingCountry)
224        && Objects.equal(this.publishingOrganizationKey, that.publishingOrganizationKey)
225        && Objects.equal(this.publishingOrganizationTitle, that.publishingOrganizationTitle)
226        && Objects.equal(this.decades, that.decades)
227        && Objects.equal(this.keywords, that.keywords)
228        && Objects.equal(this.license, that.license)
229        && Objects.equal(this.projectIdentifier, that.projectIdentifier)
230        && Objects.equal(this.recordCount, that.recordCount);
231    }
232    return false;
233  }
234
235  @Override
236  public String toString() {
237    return Objects.toStringHelper(this)
238      .add("key", key)
239      .add("title", title)
240      .add("description", description)
241      .add("type", type)
242      .add("subtype", subtype)
243      .add("fullText", fullText)
244      .add("hostingOrganizationKey", hostingOrganizationKey)
245      .add("hostingOrganizationTitle", hostingOrganizationTitle)
246      .add("publisherTitle", publisherTitle)
247      .add("countryCoverage", countryCoverage)
248      .add("continent", continent)
249      .add("publishingCountry", publishingCountry)
250      .add("publishingOrganizationKey", publishingOrganizationKey)
251      .add("publishingOrganizationTitle", publishingOrganizationTitle)
252      .add("decades", decades)
253      .add("keywords", keywords)
254      .add("license", license)
255      .add("projectIdentifier", projectIdentifier)
256      .add("recordCount", recordCount)
257      .toString();
258  }
259}