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.vocabulary.DatasetSubtype;
019import org.gbif.api.vocabulary.DatasetType;
020
021import java.util.Objects;
022import java.util.StringJoiner;
023import java.util.UUID;
024
025/**
026 * The dataset search model object for suggest searches of datasets.
027 */
028public class DatasetSuggestResult {
029
030  private UUID key;
031  private String title;
032  private String description;
033  private DatasetType type;
034  private DatasetSubtype subtype;
035
036  public UUID getKey() {
037    return key;
038  }
039
040  public void setKey(UUID key) {
041    this.key = key;
042  }
043
044  public String getTitle() {
045    return title;
046  }
047
048  public void setTitle(String title) {
049    this.title = title;
050  }
051
052  public String getDescription() {
053    return description;
054  }
055
056  public void setDescription(String description) {
057    this.description = description;
058  }
059
060  public DatasetType getType() {
061    return type;
062  }
063
064  public void setType(DatasetType type) {
065    this.type = type;
066  }
067
068  public DatasetSubtype getSubtype() {
069    return subtype;
070  }
071
072  public void setSubtype(DatasetSubtype subtype) {
073    this.subtype = subtype;
074  }
075
076  @Override
077  public boolean equals(Object o) {
078    if (this == o) {
079      return true;
080    }
081    if (o == null || getClass() != o.getClass()) {
082      return false;
083    }
084    DatasetSuggestResult that = (DatasetSuggestResult) o;
085    return Objects.equals(key, that.key) &&
086      Objects.equals(title, that.title) &&
087      Objects.equals(description, that.description) &&
088      type == that.type &&
089      subtype == that.subtype;
090  }
091
092  @Override
093  public int hashCode() {
094    return Objects.hash(key, title, description, type, subtype);
095  }
096
097  @Override
098  public String toString() {
099    return new StringJoiner(", ", DatasetSuggestResult.class.getSimpleName() + "[", "]")
100      .add("key=" + key)
101      .add("title='" + title + "'")
102      .add("description='" + description + "'")
103      .add("type=" + type)
104      .add("subtype=" + subtype)
105      .toString();
106  }
107}