@Override
public Set<Resource> getResources(Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
Set<Resource> resources = new HashSet<Resource>();
ViewRegistry viewRegistry = ViewRegistry.getInstance();
Set<String> requestedIds = getRequestPropertyIds(request, predicate);
Set<Map<String, Object>> propertyMaps = getPropertyMaps(predicate);
if (propertyMaps.isEmpty()) {
propertyMaps.add(Collections.<String, Object>emptyMap());
}
for (Map<String, Object> propertyMap : propertyMaps) {
String viewName = (String) propertyMap.get(VIEW_NAME_PROPERTY_ID);
String viewVersion = (String) propertyMap.get(VIEW_VERSION_PROPERTY_ID);
String instanceName = (String) propertyMap.get(INSTANCE_NAME_PROPERTY_ID);
for (ViewEntity viewDefinition : viewRegistry.getDefinitions()){
if (viewName == null || viewName.equals(viewDefinition.getCommonName())) {
for (ViewInstanceEntity viewInstanceDefinition : viewRegistry.getInstanceDefinitions(viewDefinition)) {
if (instanceName == null || instanceName.equals(viewInstanceDefinition.getName())) {
if (viewVersion == null || viewVersion.equals(viewDefinition.getVersion())) {
Resource resource = toResource(viewInstanceDefinition, requestedIds);
resources.add(resource);
}