public Map<PropertyInfo, String> getPropertiesWithPropertyType(PropertyType propertyType, Cluster cluster,
                                                                 Map<String, DesiredConfig> desiredConfigs, Map<String, ServiceInfo> servicesMap,
                                                                 Set<PropertyInfo> stackProperties) throws AmbariException {
    Map<String, Config> actualConfigs = new HashMap<>();
    Map<PropertyInfo, String> result = new HashMap<>();

    for (Map.Entry<String, DesiredConfig> desiredConfigEntry : desiredConfigs.entrySet()) {
      String configType = desiredConfigEntry.getKey();
      DesiredConfig desiredConfig = desiredConfigEntry.getValue();
      actualConfigs.put(configType, cluster.getConfig(configType, desiredConfig.getTag()));
    }

    for (Service service : cluster.getServices().values()) {
      ServiceInfo serviceInfo = servicesMap.get(service.getName());
      if (serviceInfo == null) {
        continue;
      }
      Set<PropertyInfo> serviceProperties = new HashSet<>(serviceInfo.getProperties());
      for (PropertyInfo serviceProperty : serviceProperties) {
        if (serviceProperty.getPropertyTypes().contains(propertyType)) {
          String stackPropertyConfigType = fileNameToConfigType(serviceProperty.getFilename());
          try {
            String property = actualConfigs.get(stackPropertyConfigType).getProperties().get(serviceProperty.getName());
            if (null == property){
              LOG.error(String.format("Unable to obtain property values for %s with property attribute %s. "
                  + "The property does not exist in version %s of %s configuration.",
                serviceProperty.getName(),
                propertyType,
                desiredConfigs.get(stackPropertyConfigType),
                stackPropertyConfigType
              ));
            } else {
              result.put(serviceProperty, property);
            }
          } catch (Exception ignored) {
          }
        }
      }
    }


    for (PropertyInfo stackProperty : stackProperties) {
      if (stackProperty.getPropertyTypes().contains(propertyType)) {
        String stackPropertyConfigType = fileNameToConfigType(stackProperty.getFilename());
        if (actualConfigs.containsKey(stackPropertyConfigType)) {
          result.put(stackProperty, actualConfigs.get(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
        }
      }
    }

    return result;
  }
Fetch all the properties of a given PropertyType. For eg: Fetch all cluster configs that are of type "user"
@param propertyType
@param cluster
@param desiredConfigs
@param servicesMap
@param stackProperties
@return
ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java