Add metadata filters to metadata resolver.

@param metadataProvider   the metadata provider
@param metadataFilterList the metadata filter list
233
protected void addMetadataFiltersToMetadataResolver(final AbstractMetadataResolver metadataProvider, final MetadataFilter... metadataFilterList) {
        addMetadataFiltersToMetadataResolver(metadataProvider, Arrays.stream(metadataFilterList).collect(Collectors.toList()));
    }
779642
public void addMetadata(Metadata meta) {
    for (String k : meta.keySet()) {
      for (TiffObject to : meta.getList(k)) {
        add(k, to, meta.getMetadataObject(k).isDublinCore(), meta.getMetadataObject(k).getPath());
      }
    }
  }
846005
public <T> Evaluator<List<T>> createEvaluator(QueryMetadata metadata,
            Expression<? extends T> source, Predicate filter) {
        String typeName = ClassUtils.getName(source.getType());
        CollQuerySerializer ser = new CollQuerySerializer(templates);
        ser.append("java.util.List<" + typeName + "> rv = new java.util.ArrayList<" + typeName + ">();\n");
        ser.append("for (" + typeName + " " + source + " : " + source + "_) {\n");
        ser.append("    try {\n");
        ser.append("        if (").handle(filter).append(") {\n");
        ser.append("            rv.add(" + source + ");\n");
        ser.append("        }\n");
        ser.append("    } catch (NullPointerException npe) { }\n");
        ser.append("}\n");
        ser.append("return rv;");

        Map<Object,String> constantToLabel = ser.getConstantToLabel();
        Map<String, Object> constants = getConstants(metadata, constantToLabel);

        Type sourceType = new ClassType(TypeCategory.SIMPLE, source.getType());
        ClassType sourceListType = new ClassType(TypeCategory.SIMPLE, Iterable.class, sourceType);

        return factory.createEvaluator(
                ser.toString(),
                sourceListType,
                new String[]{source + "_"},
                new Type[]{sourceListType},
                new Class<?>[]{Iterable.class},
                constants);
    }
626671
public java.util.List<alluxio.grpc.MasterInfoField> getFilterList() {
    return new com.google.protobuf.Internal.ListAdapter<
        java.lang.Integer, alluxio.grpc.MasterInfoField>(filter_, filter_converter_);
  }
152370
void addNamedFilters(String filterNameList) {
        String[] touchFilterNames = filterNameList.split(",");
        if (touchFilterNames != null) {
            for (String touchFilterName : touchFilterNames) {
                String s = touchFilterName.trim();
                if (s.length() > 0) {
                    addNamedFilter(s);
                }
            }
        }
    }
753054
private List<MetadataResolver> buildSingleMetadataResolver(final MetadataFilter metadataFilterChain, final Resource resource, final Document document) {
        try {
            val metadataRoot = document.getDocumentElement();
            val metadataProvider = new DOMMetadataResolver(metadataRoot);
            metadataProvider.setParserPool(this.configBean.getParserPool());
            metadataProvider.setFailFastInitialization(true);
            metadataProvider.setRequireValidMetadata(this.requireValidMetadata);
            metadataProvider.setId(metadataProvider.getClass().getCanonicalName());
            if (metadataFilterChain != null) {
                metadataProvider.setMetadataFilter(metadataFilterChain);
            }
            LOGGER.debug("Initializing metadata resolver for [{}]", resource);
            metadataProvider.initialize();
            val resolvers = new ArrayList<MetadataResolver>();
            resolvers.add(metadataProvider);
            return resolvers;
        } catch (final Exception ex) {
            LOGGER.warn("Could not initialize metadata resolver. Resource will be ignored", ex);
        }
        return new ArrayList<>(0);
    }
1009337
public void addTemplateResolver(final ITemplateResolver templateResolver) {
        Validate.notNull(templateResolver, "Template Resolver cannot be null");
        checkNotInitialized();
        this.templateResolvers.add(templateResolver);
    }
695413
protected void buildRequiredValidUntilFilterIfNeeded(final SamlRegisteredService service, final List<MetadataFilter> metadataFilterList) {
        if (service.getMetadataMaxValidity() > 0) {
            val requiredValidUntilFilter = new RequiredValidUntilFilter(service.getMetadataMaxValidity());
            metadataFilterList.add(requiredValidUntilFilter);
            LOGGER.debug("Added metadata RequiredValidUntilFilter with max validity of [{}]", service.getMetadataMaxValidity());
        } else {
            LOGGER.debug("No metadata maximum validity criteria is defined for [{}], so RequiredValidUntilFilter will not be invoked",
                service.getMetadataLocation());
        }
    }
1029062
protected void configureAndInitializeSingleMetadataResolver(final AbstractMetadataResolver metadataProvider,
                                                                final SamlRegisteredService service,
                                                                final List<MetadataFilter> metadataFilterList) throws Exception {
        val md = samlIdPProperties.getMetadata();
        metadataProvider.setParserPool(this.configBean.getParserPool());
        metadataProvider.setFailFastInitialization(md.isFailFast());
        metadataProvider.setRequireValidMetadata(md.isRequireValidMetadata());
        metadataProvider.setId(metadataProvider.getClass().getCanonicalName());

        buildMetadataFilters(service, metadataProvider, metadataFilterList);

        LOGGER.debug("Initializing metadata resolver from [{}]", service.getMetadataLocation());
        metadataProvider.initialize();
        LOGGER.info("Initialized metadata resolver from [{}]", service.getMetadataLocation());
    }
1295948
public static Optional<MultifactorAuthenticationProvider> resolveProvider(final Map<String, MultifactorAuthenticationProvider> providers,
                                                                              final String requestMfaMethod) {
        return resolveProvider(providers, Stream.of(requestMfaMethod).collect(Collectors.toList()));
    }
452529
public void setSearchFilter(String searchFilter) {

        if (!m_metadata.isSearchable()) {
            return;
        }
        if (searchFilter == null) {
            searchFilter = "";
        }
        m_searchFilter = searchFilter;
        boolean showAll = CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_searchFilter);
        getMetadata().getSearchAction().getShowAllAction().setVisible(showAll);
        if (!m_metadata.isSelfManaged()) {
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(searchFilter)) {

                // reset content if filter is empty
                m_filteredItems = null;
            } else {
                m_filteredItems = getMetadata().getSearchAction().filter(getAllContent(), m_searchFilter);
            }
        }
        String sCol = m_sortedColumn;
        m_sortedColumn = "";
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(sCol)) {
            CmsListOrderEnum order = getCurrentSortOrder();
            setSortedColumn(sCol);
            if (order == CmsListOrderEnum.ORDER_DESCENDING) {
                setSortedColumn(sCol);
            }
        }
        setCurrentPage(1);
    }
1258861
private List<MetadataResolver> loadMetadataFromResource(final MetadataFilter metadataFilter, final Resource resource, final String entityId) {
        LOGGER.debug("Evaluating metadata resource [{}]", resource.getFilename());
        try (val in = getResourceInputStream(resource, entityId)) {
            if (in.available() > 0 && in.markSupported()) {
                LOGGER.debug("Parsing [{}]", resource.getFilename());
                val document = this.configBean.getParserPool().parse(in);
                return buildSingleMetadataResolver(metadataFilter, resource, document);
            }
            LOGGER.warn("Input stream from resource [{}] appears empty. Moving on...", resource.getFilename());
        } catch (final Exception e) {
            LOGGER.warn("Could not retrieve input stream from resource. Moving on...", e);
        }
        return new ArrayList<>(0);
    }
1178433
public void registerFilters() {
        if (Clz.classExists("org.n3r.eql.eqler.annotations.Eqler")) {
            addExcludeFilter(new AnnotationTypeFilter(Eqler.class));
            addExcludeFilter(new AnnotationTypeFilter(EqlerConfig.class));
        }

        addIncludeFilter((metadataReader, metadataReaderFactory) -> {
            val metadata = metadataReader.getClassMetadata();
            if (!metadata.isInterface()) return false;

            val className = metadata.getClassName();
            val clazz = Clz.forName(className);
            return Anns.isFastWestCacheAnnotated(clazz);
        });

    }
265781
private FilterList getFilterList(Filter filters)
    {
        FilterList filterList = null;
        if (filters != null)
        {
            if (FilterList.class.isAssignableFrom(filters.getClass()))
            {
                filterList = (FilterList) filters;
            }
            else
            {
                filterList = new FilterList();
                filterList.addFilter(filters);
            }
        }
        return filterList;
    }
1104179
private void addFilters(MpxjTreeNode parentNode, List<Filter> filters)
   {
      for (Filter field : filters)
      {
         final Filter f = field;
         MpxjTreeNode childNode = new MpxjTreeNode(field)
         {
            @Override public String toString()
            {
               return f.getName();
            }
         };
         parentNode.add(childNode);
      }
   }
303492
public void addFilter(Filter filter)
   {
      if (filter.isTaskFilter())
      {
         m_taskFilters.add(filter);
      }

      if (filter.isResourceFilter())
      {
         m_resourceFilters.add(filter);
      }

      m_filtersByName.put(filter.getName(), filter);
      m_filtersByID.put(filter.getID(), filter);
   }
610624
@Override
	public String[] selectImports(AnnotationMetadata metadata) {

		Map<String, Object> attributes = metadata.getAnnotationAttributes(EnableHypermediaSupport.class.getName());

		Collection<MediaType> types = attributes == null ? Collections.emptyList()
				: Arrays.stream((HypermediaType[]) attributes.get("type")) //
						.flatMap(it -> it.getMediaTypes().stream()) //
						.collect(Collectors.toList());

		Collection<MediaTypeConfigurationProvider> configurationProviders = SpringFactoriesLoader.loadFactories(
				MediaTypeConfigurationProvider.class, HypermediaConfigurationImportSelector.class.getClassLoader());

		// No additional filtering needed.
		if (types.isEmpty()) {
			return configurationProviders.toArray(new String[0]);
		}

		// Filter the ones supporting the given media types
		return configurationProviders.stream() //
				.filter(it -> it.supportsAny(types)) //
				.map(MediaTypeConfigurationProvider::getConfiguration) //
				.map(Class::getName) //
				.toArray(String[]::new);
	}