001/*
002 * Licensed under the Apache License, Version 2.0 (the "License");
003 * you may not use this file except in compliance with the License.
004 * You may obtain a copy of the License at
005 *
006 *     http://www.apache.org/licenses/LICENSE-2.0
007 *
008 * Unless required by applicable law or agreed to in writing, software
009 * distributed under the License is distributed on an "AS IS" BASIS,
010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
011 * See the License for the specific language governing permissions and
012 * limitations under the License.
013 */
014package org.gbif.api.model.registry;
015
016import org.gbif.api.vocabulary.MaintenanceUpdateFrequency;
017
018import javax.annotation.Nullable;
019import java.util.Date;
020import java.util.Objects;
021import java.util.StringJoiner;
022
023/**
024 * A description of single changes made to the data.
025 */
026@SuppressWarnings({"unused", "LombokSetterMayBeUsed", "LombokGetterMayBeUsed"})
027public class MaintenanceChange {
028
029  private String changeScope;
030  private MaintenanceUpdateFrequency oldValue;
031  private Date changeDate;
032  private String comment;
033
034  public String getChangeScope() {
035    return changeScope;
036  }
037
038  public void setChangeScope(String changeScope) {
039    this.changeScope = changeScope;
040  }
041
042  public MaintenanceUpdateFrequency getOldValue() {
043    return oldValue;
044  }
045
046  public void setOldValue(MaintenanceUpdateFrequency oldValue) {
047    this.oldValue = oldValue;
048  }
049
050  public Date getChangeDate() {
051    return changeDate;
052  }
053
054  public void setChangeDate(Date changeDate) {
055    this.changeDate = changeDate;
056  }
057
058  @Nullable
059  public String getComment() {
060    return comment;
061  }
062
063  public void setComment(String comment) {
064    this.comment = comment;
065  }
066
067  @Override
068  public boolean equals(Object o) {
069    if (this == o) return true;
070    if (o == null || getClass() != o.getClass()) return false;
071    MaintenanceChange that = (MaintenanceChange) o;
072    return Objects.equals(changeScope, that.changeScope)
073        && Objects.equals(oldValue, that.oldValue)
074        && Objects.equals(changeDate, that.changeDate)
075        && Objects.equals(comment, that.comment);
076  }
077
078  @Override
079  public int hashCode() {
080    return Objects.hash(changeScope, oldValue, changeDate, comment);
081  }
082
083  @Override
084  public String toString() {
085    return new StringJoiner(", ", MaintenanceChange.class.getSimpleName() + "[", "]")
086        .add("changeScope='" + changeScope + "'")
087        .add("oldValue='" + oldValue + "'")
088        .add("changeDate=" + changeDate)
089        .add("comment='" + comment + "'")
090        .toString();
091  }
092}