All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.singularity.SingularityDeployHistory Maven / Gradle / Ivy

The newest version!
package com.hubspot.singularity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Objects;
import com.google.common.base.Optional;

public class SingularityDeployHistory implements Comparable, SingularityHistoryItem {

  private final Optional deployResult;
  private final SingularityDeployMarker deployMarker;
  private final Optional deploy;
  private final Optional deployStatistics;

  @JsonCreator
  public SingularityDeployHistory(@JsonProperty("deployResult") Optional deployResult, @JsonProperty("deployMarker") SingularityDeployMarker deployMarker,
      @JsonProperty("deploy") Optional deploy, @JsonProperty("deployStatistics") Optional deployStatistics) {
    this.deployResult = deployResult;
    this.deployMarker = deployMarker;
    this.deploy = deploy;
    this.deployStatistics = deployStatistics;
  }

  @Override
  public int compareTo(SingularityDeployHistory o) {
    return o.getDeployMarker().compareTo(getDeployMarker());
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(deployResult, deployMarker, deploy, deployStatistics);
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) {
      return true;
    }
    if (other == null || other.getClass() != this.getClass()) {
      return false;
    }

    SingularityDeployHistory that = (SingularityDeployHistory) other;
    return Objects.equal(this.deployResult, that.deployResult)
        && Objects.equal(this.deployMarker, that.deployMarker)
        && Objects.equal(this.deploy, that.deploy)
        && Objects.equal(this.deployStatistics, that.deployStatistics);
  }

  public Optional getDeployResult() {
    return deployResult;
  }

  public SingularityDeployMarker getDeployMarker() {
    return deployMarker;
  }

  public Optional getDeploy() {
    return deploy;
  }

  @Override
  @JsonIgnore
  public long getCreateTimestampForCalculatingHistoryAge() {
    return deployMarker.getTimestamp();
  }

  public Optional getDeployStatistics() {
    return deployStatistics;
  }

  @Override
  public String toString() {
    return "SingularityDeployHistory [deployResult=" + deployResult + ", deployMarker=" + deployMarker + ", deploy=" + deploy + ", deployStatistics=" + deployStatistics + "]";
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy