class AmbariPrivilegeResourceProvider extends PrivilegeResourceProvider<Object> {

  @Override
  protected Resource toResource(PrivilegeEntity privilegeEntity,
                                Map<Long, UserEntity> userEntities,
                                Map<Long, GroupEntity> groupEntities,
                                Map<Long, PermissionEntity> roleEntities,
                                Map<Long, Object> resourceEntities,
                                Set<String> requestedIds) {
    Resource resource = super.toResource(privilegeEntity, userEntities, groupEntities, roleEntities, resourceEntities, requestedIds);
    if (resource != null) {
      ResourceEntity resourceEntity = privilegeEntity.getResource();
      ResourceTypeEntity type = resourceEntity.getResourceType();
      String typeName = type.getName();
      ResourceType resourceType = ResourceType.translate(typeName);

      if(resourceType != null) {
        switch (resourceType) {
          case AMBARI:
            // there is nothing special to add for this case
            break;
          case CLUSTER:
            ClusterEntity clusterEntity = (ClusterEntity) resourceEntities.get(resourceEntity.getId());
            setResourceProperty(resource, CLUSTER_NAME, clusterEntity.getClusterName(), requestedIds);
            break;
          case VIEW:
            ViewInstanceEntity viewInstanceEntity = (ViewInstanceEntity) resourceEntities.get(resourceEntity.getId());
            ViewEntity viewEntity = viewInstanceEntity.getViewEntity();

            setResourceProperty(resource, VIEW_NAME, viewEntity.getCommonName(), requestedIds);
            setResourceProperty(resource, VERSION, viewEntity.getVersion(), requestedIds);
            setResourceProperty(resource, INSTANCE_NAME, viewInstanceEntity.getName(), requestedIds);
            break;
        }

        setResourceProperty(resource, TYPE, resourceType.name(), requestedIds);
      }
    }

    return resource;
  }

  public  AmbariPrivilegeResourceProvider();

}