@Override
  public Set<Resource> getResources(Request request, Predicate predicate)
      throws SystemException, UnsupportedPropertyException,
      NoSuchResourceException, NoSuchParentResourceException {

    Set<Resource> resourceSet = new HashSet<>();

    Set<ViewInstanceEntity> instanceDefinitions = new HashSet<>();

    Set<Map<String, Object>> propertyMaps = getPropertyMaps(predicate);
    int size = propertyMaps.size();

    Collection<ViewInstanceEntity> viewInstanceDefinitions = viewDefinition.getInstances();
    if (size == 0) {
      instanceDefinitions.addAll(viewInstanceDefinitions);
    } else {
      for (Map<String, Object> propertyMap : propertyMaps) {
        String instanceName = (String) propertyMap.get(INSTANCE_NAME_PROPERTY_ID);
        if (instanceName == null) {
          instanceDefinitions.addAll(viewInstanceDefinitions);
          break;
        } else {
          instanceDefinitions.add(viewDefinition.getInstanceDefinition(instanceName));
        }
      }
    }

    for (ViewInstanceEntity viewInstanceDefinition : instanceDefinitions) {
      for (String resourceName : resourceNames) {
        ResourceImpl resource = new ResourceImpl(type);
        resource.setProperty(VIEW_NAME_PROPERTY_ID, viewDefinition.getCommonName());
        resource.setProperty(VIEW_VERSION_PROPERTY_ID, viewDefinition.getVersion());
        resource.setProperty(INSTANCE_NAME_PROPERTY_ID, viewInstanceDefinition.getName());
        resource.setProperty("name", resourceName);
        resourceSet.add(resource);
      }
    }

    return resourceSet;
  }
Construct a view sub-resource provider.

@param type            the resource type
@param viewDefinition  the associated view definition
ambari-server/src/main/java/org/apache/ambari/server/view/ViewExternalSubResourceProvider.java