protected static boolean setResourceProperty(Resource resource, String propertyId, Object value,
                                               Set<String> requestedIds) {
    boolean contains = requestedIds.contains(propertyId) || isPropertyCategoryRequested(propertyId, requestedIds);

    if (contains) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Setting property for resource, resourceType={}, propertyId={}, value={}", resource.getType(), propertyId, value);
      }

      // If the value is a Map then set all of its entries as properties
      if (!setResourceMapProperty(resource, propertyId, value)){
        resource.setProperty(propertyId, value);
      }
    }
    else {

      if (value instanceof Map<?, ?>) {
        // This map wasn't requested, but maybe some of its entries were...
        Map<?, ?> mapValue = (Map) value;

        for (Map.Entry entry : mapValue.entrySet()) {
          String entryPropertyId = PropertyHelper.getPropertyId(propertyId, entry.getKey().toString());
          Object entryValue      = entry.getValue();

          contains = setResourceProperty(resource, entryPropertyId, entryValue, requestedIds) || contains;
        }
      }

      if (!contains && LOG.isDebugEnabled()) {
        LOG.debug("Skipping property for resource as not in requestedIds, resourceType={}, propertyId={}, value={}", resource.getType(), propertyId, value);
      }
    }
    return contains;
  }
Set a property value on the given resource for the given id and value.
Make sure that the id is in the given set of requested ids.

@param resource      the resource
@param propertyId    the property id
@param value         the value to set
@param requestedIds  the requested set of property ids
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseProvider.java