public static RepositoryVersionState getAggregateState(List<RepositoryVersionState> states) {
    if (null == states || states.isEmpty()) {
      return NOT_REQUIRED;
    }

    RepositoryVersionState heaviestState = states.get(0);
    for (RepositoryVersionState state : states) {
      if (state.weight > heaviestState.weight) {
        heaviestState = state;
      }
    }

    return heaviestState;
  }
Gets a single representation of the repository state based on the supplied
states.

@param states
         the states to calculate the aggregate for.
@return the "heaviest" state.
ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryVersionState.java