public static Map<HostRoleStatus, Integer> calculateTaskStatusCounts(
      Map<Long, HostRoleCommandStatusSummaryDTO> stageDto, Set<Long> stageIds) {

    List<HostRoleStatus> status = new ArrayList<>();

    for (Long stageId : stageIds) {
      if (!stageDto.containsKey(stageId)) {
        continue;
      }

      HostRoleCommandStatusSummaryDTO dto = stageDto.get(stageId);

      status.addAll(dto.getTaskStatuses());
    }

    return calculateStatusCounts(status);
  }
Return counts of task statuses.
@param stageDto  the map of stage-to-summary value objects
@param stageIds  the stage ids to consider from the value objects
@return the map of status to counts
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java