private Predicate resolvePredicate(Type type, Predicate predicate)
    throws UnsupportedPropertyException,
        SystemException,
        NoSuchResourceException,
        NoSuchParentResourceException{

    ResourceProvider provider = ensureResourceProvider(type);

    Set<String>  keyPropertyIds = new HashSet<>(provider.getKeyPropertyIds().values());
    Request      readRequest    = PropertyHelper.getReadRequest(keyPropertyIds);

    Iterable<Resource> resources = getResourceIterable(type, readRequest, predicate);

    PredicateBuilder pb = new PredicateBuilder();
    PredicateBuilder.PredicateBuilderWithPredicate pbWithPredicate = null;

    for (Resource resource : resources) {
      if (pbWithPredicate != null) {
        pb = pbWithPredicate.or();
      }

      pb              = pb.begin();
      pbWithPredicate = null;

      for (String keyPropertyId : keyPropertyIds) {
        if (pbWithPredicate != null) {
          pb = pbWithPredicate.and();
        }
        pbWithPredicate =
            pb.property(keyPropertyId).equals((Comparable) resource.getPropertyValue(keyPropertyId));
      }
      if (pbWithPredicate != null) {
        pbWithPredicate = pbWithPredicate.end();
      }
    }
    return pbWithPredicate == null ? null : pbWithPredicate.toPredicate();
  }
Check to see if any of the property ids specified in the given request and
predicate are handled by an associated property provider.  if so, then use
the given predicate to obtain a new predicate that can be completely
processed by an update or delete operation on a resource provider for
the given resource type.  This means that the new predicate should only
reference the key property ids for this type.

@param type       the resource type
@param predicate  the predicate

@return the given predicate if a new one is not required; a new predicate if required

@throws UnsupportedPropertyException thrown if any of the properties specified in the request
                                     and predicate are not supported by either the resource
                                     provider or a property provider for the given type

@throws SystemException thrown for internal exceptions
@throws NoSuchResourceException if the resource that is requested doesn't exist
@throws NoSuchParentResourceException if a parent resource of the requested resource doesn't exist
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java