protected Resource toResource(UserPrivilegeResponse response, Set<String> requestedIds){
    final ResourceImpl resource = new ResourceImpl(Resource.Type.UserPrivilege);



    setResourceProperty(resource, USER_NAME, response.getUserName(), requestedIds);
    setResourceProperty(resource, PRIVILEGE_ID, response.getPrivilegeId(), requestedIds);
    setResourceProperty(resource, PERMISSION_NAME, response.getPermissionName(), requestedIds);
    setResourceProperty(resource, PERMISSION_LABEL, response.getPermissionLabel(), requestedIds);
    setResourceProperty(resource, PRINCIPAL_TYPE, response.getPrincipalType().name(), requestedIds);
    if (response.getPrincipalName() != null) {
      setResourceProperty(resource, PRINCIPAL_NAME, response.getPrincipalName(), requestedIds);
    }
    if (response.getType() != null) {
      setResourceProperty(resource, TYPE, response.getType().name(), requestedIds);
      switch (response.getType()) {
        case CLUSTER:
          setResourceProperty(resource, CLUSTER_NAME, response.getClusterName(), requestedIds);
          break;
        case VIEW:
          setResourceProperty(resource, VIEW_NAME, response.getViewName(), requestedIds);
          setResourceProperty(resource, VIEW_VERSION, response.getVersion(), requestedIds);
          setResourceProperty(resource, INSTANCE_NAME, response.getInstanceName(), requestedIds);
          break;
      }

    }
    return resource;
  }
Translate the Response into a Resource
@param response        {@link PrivilegeResponse}
@param requestedIds    the relevant request ids
@return a resource
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java