private Map<String, String> mapServicesByComponent() {
    Map<String, String> serviceByComponent = new HashMap<>();
    for (Map.Entry<String, Map<String, Set<String>>> e : request.newServices().entrySet()) {
      String service = e.getKey();
      for (String component : e.getValue().keySet()) {
        serviceByComponent.put(component, service);
      }
    }
    return serviceByComponent;
  }
Maps services in the request by component.

@return component -> service map
ambari-server/src/main/java/org/apache/ambari/server/topology/addservice/ProvisionActionPredicateBuilder.java