001/* 002 * Copyright 2020 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.registry.search; 017 018import org.gbif.api.model.common.DOI; 019import org.gbif.api.vocabulary.Continent; 020import org.gbif.api.vocabulary.Country; 021import org.gbif.api.vocabulary.DatasetSubtype; 022import org.gbif.api.vocabulary.DatasetType; 023import org.gbif.api.vocabulary.License; 024 025import java.util.List; 026import java.util.Objects; 027import java.util.Set; 028import java.util.StringJoiner; 029import java.util.UUID; 030 031/** 032 * The dataset search model object for faceted and full text search. 033 */ 034public class DatasetSearchResult { 035 036 private UUID key; 037 private String title; 038 private DOI doi; 039 private String description; 040 private DatasetType type; 041 private DatasetSubtype subtype; 042 private String fullText; 043 private UUID hostingOrganizationKey; 044 private String hostingOrganizationTitle; 045 private Country hostingCountry; 046 private String publisherTitle; 047 private Set<Country> countryCoverage; 048 private Set<Continent> continent; 049 private Country publishingCountry; 050 private UUID publishingOrganizationKey; 051 private String publishingOrganizationTitle; 052 private UUID endorsingNodeKey; 053 private List<UUID> networkKeys; 054 private License license; 055 private List<Integer> decades; 056 private List<String> keywords; 057 private String projectIdentifier; 058 private Integer recordCount; 059 private Integer nameUsagesCount; 060 private Set<String> category; 061 062 public UUID getKey() { 063 return key; 064 } 065 066 public void setKey(UUID key) { 067 this.key = key; 068 } 069 070 public String getTitle() { 071 return title; 072 } 073 074 public void setTitle(String title) { 075 this.title = title; 076 } 077 078 public DOI getDoi() { 079 return doi; 080 } 081 082 public void setDoi(DOI doi) { 083 this.doi = doi; 084 } 085 086 public String getDescription() { 087 return description; 088 } 089 090 public void setDescription(String description) { 091 this.description = description; 092 } 093 094 public DatasetType getType() { 095 return type; 096 } 097 098 public void setType(DatasetType type) { 099 this.type = type; 100 } 101 102 public DatasetSubtype getSubtype() { 103 return subtype; 104 } 105 106 public void setSubtype(DatasetSubtype subtype) { 107 this.subtype = subtype; 108 } 109 110 public String getFullText() { 111 return fullText; 112 } 113 114 public void setFullText(String fullText) { 115 this.fullText = fullText; 116 } 117 118 public UUID getHostingOrganizationKey() { 119 return hostingOrganizationKey; 120 } 121 122 public void setHostingOrganizationKey(UUID hostingOrganizationKey) { 123 this.hostingOrganizationKey = hostingOrganizationKey; 124 } 125 126 public String getHostingOrganizationTitle() { 127 return hostingOrganizationTitle; 128 } 129 130 public void setHostingOrganizationTitle(String hostingOrganizationTitle) { 131 this.hostingOrganizationTitle = hostingOrganizationTitle; 132 } 133 134 public Country getHostingCountry() { 135 return hostingCountry; 136 } 137 138 public void setHostingCountry(Country hostingCountry) { 139 this.hostingCountry = hostingCountry; 140 } 141 142 public String getPublisherTitle() { 143 return publisherTitle; 144 } 145 146 public void setPublisherTitle(String publisherTitle) { 147 this.publisherTitle = publisherTitle; 148 } 149 150 public UUID getEndorsingNodeKey() { 151 return endorsingNodeKey; 152 } 153 154 public void setEndorsingNodeKey(UUID endorsingNodeKey) { 155 this.endorsingNodeKey = endorsingNodeKey; 156 } 157 158 /** 159 * Currently not populated. 160 * TODO: http://dev.gbif.org/issues/browse/REG-393 161 */ 162 public Set<Country> getCountryCoverage() { 163 return countryCoverage; 164 } 165 166 public void setCountryCoverage(Set<Country> countryCoverage) { 167 this.countryCoverage = countryCoverage; 168 } 169 170 /** 171 * Currently not populated. 172 * TODO: http://dev.gbif.org/issues/browse/REG-393 173 */ 174 public Set<Continent> getContinent() { 175 return continent; 176 } 177 178 public void setContinent(Set<Continent> continent) { 179 this.continent = continent; 180 } 181 182 public Country getPublishingCountry() { 183 return publishingCountry; 184 } 185 186 public void setPublishingCountry(Country publishingCountry) { 187 this.publishingCountry = publishingCountry; 188 } 189 190 public UUID getPublishingOrganizationKey() { 191 return publishingOrganizationKey; 192 } 193 194 public void setPublishingOrganizationKey(UUID publishingOrganizationKey) { 195 this.publishingOrganizationKey = publishingOrganizationKey; 196 } 197 198 public String getPublishingOrganizationTitle() { 199 return publishingOrganizationTitle; 200 } 201 202 public void setPublishingOrganizationTitle(String publishingOrganizationTitle) { 203 this.publishingOrganizationTitle = publishingOrganizationTitle; 204 } 205 206 public List<UUID> getNetworkKeys() { 207 return networkKeys; 208 } 209 210 public void setNetworkKeys(List<UUID> networkKeys) { 211 this.networkKeys = networkKeys; 212 } 213 214 public License getLicense() { 215 return license; 216 } 217 218 public void setLicense(License license) { 219 this.license = license; 220 } 221 222 public List<Integer> getDecades() { 223 return decades; 224 } 225 226 public void setDecades(List<Integer> decades) { 227 this.decades = decades; 228 } 229 230 public List<String> getKeywords() { 231 return keywords; 232 } 233 234 public void setKeywords(List<String> keywords) { 235 this.keywords = keywords; 236 } 237 238 public String getProjectIdentifier() { 239 return projectIdentifier; 240 } 241 242 public void setProjectIdentifier(String projectIdentifier) { 243 this.projectIdentifier = projectIdentifier; 244 } 245 246 public Integer getRecordCount() { 247 return recordCount; 248 } 249 250 public void setRecordCount(Integer recordCount) { 251 this.recordCount = recordCount; 252 } 253 254 public Integer getNameUsagesCount() { 255 return nameUsagesCount; 256 } 257 258 public void setNameUsagesCount(Integer nameUsagesCount) { 259 this.nameUsagesCount = nameUsagesCount; 260 } 261 262 public Set<String> getCategory() { 263 return category; 264 } 265 266 public void setCategory(Set<String> category) { 267 this.category = category; 268 } 269 270 271 @Override 272 public boolean equals(Object o) { 273 if (this == o) { 274 return true; 275 } 276 if (o == null || getClass() != o.getClass()) { 277 return false; 278 } 279 DatasetSearchResult that = (DatasetSearchResult) o; 280 return Objects.equals(key, that.key) && 281 Objects.equals(title, that.title) && 282 Objects.equals(doi, that.doi) && 283 Objects.equals(description, that.description) && 284 type == that.type && 285 subtype == that.subtype && 286 Objects.equals(fullText, that.fullText) && 287 Objects.equals(hostingOrganizationKey, that.hostingOrganizationKey) && 288 Objects.equals(hostingOrganizationTitle, that.hostingOrganizationTitle) && 289 Objects.equals(publisherTitle, that.publisherTitle) && 290 Objects.equals(countryCoverage, that.countryCoverage) && 291 Objects.equals(continent, that.continent) && 292 publishingCountry == that.publishingCountry && 293 Objects.equals(publishingOrganizationKey, that.publishingOrganizationKey) && 294 Objects.equals(publishingOrganizationTitle, that.publishingOrganizationTitle) && 295 license == that.license && 296 Objects.equals(decades, that.decades) && 297 Objects.equals(keywords, that.keywords) && 298 Objects.equals(projectIdentifier, that.projectIdentifier) && 299 Objects.equals(recordCount, that.recordCount) && 300 Objects.equals(networkKeys, that.networkKeys) && 301 Objects.equals(nameUsagesCount, that.nameUsagesCount) && 302 Objects.equals(category, that.category); 303 } 304 305 @Override 306 public int hashCode() { 307 return Objects.hash(key, title, doi, description, type, subtype, fullText, hostingOrganizationKey, 308 hostingOrganizationTitle, publisherTitle, countryCoverage, continent, publishingCountry, 309 publishingOrganizationKey, publishingOrganizationTitle, license, decades, keywords, 310 projectIdentifier, recordCount, networkKeys, nameUsagesCount, category); 311 } 312 313 @Override 314 public String toString() { 315 return new StringJoiner(", ", DatasetSearchResult.class.getSimpleName() + "[", "]") 316 .add("key=" + key) 317 .add("title='" + title + "'") 318 .add("doi='" + doi + "'") 319 .add("description='" + description + "'") 320 .add("type=" + type) 321 .add("subtype=" + subtype) 322 .add("fullText='" + fullText + "'") 323 .add("hostingOrganizationKey=" + hostingOrganizationKey) 324 .add("hostingOrganizationTitle='" + hostingOrganizationTitle + "'") 325 .add("publisherTitle='" + publisherTitle + "'") 326 .add("countryCoverage=" + countryCoverage) 327 .add("continent=" + continent) 328 .add("publishingCountry=" + publishingCountry) 329 .add("publishingOrganizationKey=" + publishingOrganizationKey) 330 .add("publishingOrganizationTitle='" + publishingOrganizationTitle + "'") 331 .add("license=" + license) 332 .add("decades=" + decades) 333 .add("keywords=" + keywords) 334 .add("projectIdentifier='" + projectIdentifier + "'") 335 .add("recordCount=" + recordCount) 336 .add("networkKeys=" + networkKeys) 337 .add("nameUsagesCount=" + nameUsagesCount) 338 .add("category=" + category) 339 .toString(); 340 } 341}