private List<HostOrderItem> extractHostOrderItemsFromRequest(Map<String, Object> requestMap)
        throws AmbariException {
      // ewwww
      Set<Map<String, List<String>>> hostsOrder = (Set<Map<String, List<String>>>) requestMap.get(
          UPGRADE_HOST_ORDERED_HOSTS);

      if (CollectionUtils.isEmpty(hostsOrder)) {
        throw new AmbariException(
            String.format("The %s property must be specified when using a %s upgrade type.",
                UPGRADE_HOST_ORDERED_HOSTS, UpgradeType.HOST_ORDERED));
      }

      List<HostOrderItem> hostOrderItems = new ArrayList<>();

      // extract all of the hosts so that we can ensure they are all accounted
      // for
      Iterator<Map<String, List<String>>> iterator = hostsOrder.iterator();
      while (iterator.hasNext()) {
        Map<String, List<String>> grouping = iterator.next();
        List<String> hosts = grouping.get("hosts");
        List<String> serviceChecks = grouping.get("service_checks");

        if (CollectionUtils.isEmpty(hosts) && CollectionUtils.isEmpty(serviceChecks)) {
          throw new AmbariException(String.format(
              "The %s property must contain at least one object with either a %s or %s key",
              UPGRADE_HOST_ORDERED_HOSTS, "hosts", "service_checks"));
        }

        if (CollectionUtils.isNotEmpty(hosts)) {
          hostOrderItems.add(new HostOrderItem(HostOrderActionType.HOST_UPGRADE, hosts));
        }

        if (CollectionUtils.isNotEmpty(serviceChecks)) {
          hostOrderItems.add(new HostOrderItem(HostOrderActionType.SERVICE_CHECK, serviceChecks));
        }
      }

      return hostOrderItems;
    }
Builds the list of {@link HostOrderItem}s from the upgrade request. If
the upgrade request does not contain the hosts

@param requestMap
         the map of properties from the request (not {@code null}).
@return the ordered list of actions to orchestrate for the
        {@link UpgradeType#HOST_ORDERED} upgrade.
@throws AmbariException
          if the request properties are not valid.
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/UpgradeContext.java