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