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

    PrivilegeEntity that = (PrivilegeEntity) o;
    return Objects.equals(id, that.id) &&
        Objects.equals(permission, that.permission) &&
        Objects.equals(principal, that.principal) &&
        Objects.equals(resource, that.resource);
  }
Set the principal entity.

@param principal  the principal entity
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PrivilegeEntity.java