@Override
  public boolean equals(Object object) {
    if (this == object) {
      return true;
    }

    if (object == null || getClass() != object.getClass()) {
      return false;
    }

    AlertHistoryEntity that = (AlertHistoryEntity) object;

    // use the unique ID if it exists
    if( null != alertId ){
      return Objects.equals(alertId, that.alertId);
    }

    return Objects.equals(alertId, that.alertId) &&
        Objects.equals(clusterId, that.clusterId) &&
        Objects.equals(alertInstance, that.alertInstance) &&
        Objects.equals(alertLabel, that.alertLabel) &&
        Objects.equals(alertState, that.alertState) &&
        Objects.equals(alertText, that.alertText) &&
        Objects.equals(alertTimestamp, that.alertTimestamp) &&
        Objects.equals(serviceName, that.serviceName) &&
        Objects.equals(componentName, that.componentName) &&
        Objects.equals(hostName, that.hostName) &&
        Objects.equals(alertDefinition, that.alertDefinition);
  }
Gets the equality to another historical alert entry based on the following criteria:
<ul>
<li>{@link #alertId}
<li>{@link #clusterId}
<li>{@link #alertInstance}
<li>{@link #alertLabel}
<li>{@link #alertState}
<li>{@link #alertText}
<li>{@link #alertTimestamp}
<li>{@link #serviceName}
<li>{@link #componentName}
<li>{@link #hostName}
<li>{@link #alertDefinition}
</ul>
<p/>
However, since we're guaranteed that {@link #alertId} is unique among persisted entities, we
can return the hashCode based on this value if it is set.
<p/>
{@inheritDoc}
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertHistoryEntity.java