private Command<Void> getDeleteCommand(final Predicate predicate) {
    return new Command<Void>() {
      @Override
      public Void invoke() throws AmbariException {
        try {
          for (Map<String, Object> resource : getPropertyMaps(predicate)) {
            if (resource.get(PRIVILEGE_ID) == null) {
              throw new AmbariException("Privilege ID should be provided for this request");
            }
            PrivilegeEntity entity = privilegeDAO.findById(Integer.valueOf(resource.get(PRIVILEGE_ID).toString()));
            if (entity != null) {
              if (!checkResourceTypes(entity)) {
                throw new AmbariException("Can't remove " + entity.getPermission().getResourceType().getName() +
                    " permission from a " + entity.getResource().getResourceType().getName() + " resource.");
              }
              entity.getPrincipal().getPrivileges().remove(entity);
              principalDAO.merge(entity.getPrincipal());
              privilegeDAO.remove(entity);
            }
          }
        } catch (Exception e) {
          throw new AmbariException("Caught exception deleting privilege.", e);
        }
        return null;
      }
    };
  }
Convert the given map of properties to a privilege entity for the resource
identified by the given id.

@param properties  the property map
@param resourceId  the resource id

@return the new privilege entity
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PrivilegeResourceProvider.java