001package org.gbif.api.model.registry.metasync;
002
003import java.util.Date;
004import java.util.UUID;
005
006import javax.annotation.Nullable;
007import javax.validation.constraints.NotNull;
008
009import com.google.common.base.Objects;
010
011/**
012 * Metadata synchronization historical information.
013 */
014public class MetasyncHistory {
015
016  private UUID installationKey;
017  private Date syncDate;
018  private MetasyncResult result;
019  private String details;
020  
021  /** 
022   * Key of the synchronized installation.
023   * 
024   * @return the installation key that was synchronized
025   */
026  @NotNull
027  public UUID getInstallationKey() {
028    return installationKey;
029  }
030  
031  public void setInstallationKey(UUID installationKey) {
032    this.installationKey = installationKey;
033  }
034  
035  /**
036   * Date when the metasync operation was executed.
037   * 
038   * @return timestamp when the synchronization was executed
039   */
040  @NotNull
041  public Date getSyncDate() {
042    return syncDate;
043  }
044  
045  public void setSyncDate(Date syncDate) {
046    this.syncDate = syncDate;
047  }
048  
049  /**
050   * Result of the metasync operation.
051   * 
052   * @return the result of the metasync operation
053   */
054  @Nullable
055  public MetasyncResult getResult() {
056    return result;
057  }
058  
059  public void setResult(MetasyncResult result) {
060    this.result = result;
061  }
062  
063  /**
064   * Details about the metasync operation.
065   * 
066   * @return the metasync details
067   */
068  @Nullable
069  public String getDetails() {
070    return details;
071  }
072  
073  public void setDetails(String details) {
074    this.details = details;
075  }
076  
077  
078  @Override
079  public boolean equals(Object obj) {
080    if (obj == null) {
081      return false;
082    }
083    if (getClass() != obj.getClass()) {
084      return false;
085    }
086    final MetasyncHistory other = (MetasyncHistory) obj;
087    return Objects.equal(this.installationKey, other.installationKey)
088           && Objects.equal(this.syncDate, other.syncDate)
089           && Objects.equal(this.result, other.result)
090           && Objects.equal(this.details, other.details);
091  }
092
093  @Override
094  public int hashCode() {
095    return Objects.hashCode(installationKey,syncDate,result,details);
096  }
097
098  @Override
099  public String toString() {
100    return Objects.toStringHelper(this)
101      .add("installationKey", installationKey)
102      .add("syncDate", syncDate)
103      .add("result", result)
104      .add("details", details).toString();
105  }
106}