Get the pages selected in the suffix of the URL
@param filter optional filter to select only specific pages
@param basePage the suffix path is relative to this page path (null for current page)
@return a list containing the Pages
422857
public @NotNull List<Page> getPages(@Nullable final Predicate<Page> filter, @Nullable final Page basePage) {
    Resource baseResourceToUse = null;

    // detect pages page to use
    if (basePage == null) {
      PageManager pageManager = AdaptTo.notNull(request.getResourceResolver(), PageManager.class);
      Page currentPage = pageManager.getContainingPage(request.getResource());
      if (currentPage != null) {
        baseResourceToUse = currentPage.adaptTo(Resource.class);
      }
    }
    else {
      baseResourceToUse = basePage.adaptTo(Resource.class);
    }

    // filter pages (as resources)
    Predicate<Resource> resourceFilter = new Predicate<Resource>() {
      @Override
      public boolean test(Resource resource) {
        Page page = resource.adaptTo(Page.class);
        if (page == null) {
          return false;
        }
        if (filter == null) {
          return true;
        }
        return filter.test(page);
      }
    };
    List<Resource> resources = getResourcesWithBaseResource(resourceFilter, baseResourceToUse);

    // convert resources back to pages
    return Lists.transform(resources, new Function<Resource, Page>() {
      @Override
      @SuppressWarnings("null")
      public Page apply(@Nullable Resource resource) {
        return resource.adaptTo(Page.class);
      }
    });
  }
464768
public List<CmsUrlNameMappingEntry> readUrlNameMappings(CmsUrlNameMappingFilter filter) throws CmsException {

        return m_securityManager.readUrlNameMappings(m_context, filter);
    }
141587
public static Collection<String> getBasePaths(String basePath) {
        return Collections2.transform(Lists.newArrayList(basePath.split(",")),
                s -> s.startsWith("/") ? s.substring(1) : s);
    }
1320700
public List<URL> scan(Predicate<String> filter)
    {
        List<URL> discoveredURLs = new ArrayList<>(128);

        // For each Forge addon...
        for (Addon addon : furnace.getAddonRegistry().getAddons(AddonFilters.allStarted()))
        {
            List<String> filteredResourcePaths = filterAddonResources(addon, filter);
            for (String filePath : filteredResourcePaths)
            {
                URL ruleFile = addon.getClassLoader().getResource(filePath);
                if (ruleFile != null)
                    discoveredURLs.add(ruleFile);
            }
        }
        return discoveredURLs;
    }
682666
private CmsPair<String, List<Object>> prepareRewriteAliasConditions(CmsRewriteAliasFilter filter) {

        List<String> conditions = new ArrayList<String>();
        conditions.add("1 = 1");
        List<Object> parameters = new ArrayList<Object>();
        if (filter.getSiteRoot() != null) {
            parameters.add(filter.getSiteRoot());
            conditions.add("SITE_ROOT = ?");
        }
        if (filter.getId() != null) {
            parameters.add(filter.getId().toString());
            conditions.add("ID = ?");
        }
        return CmsPair.create(CmsStringUtil.listAsString(conditions, " AND "), parameters);
    }
921619
public List getFacesExtensionsFilterMappings()
    {
        if (_facesExtensionsFilterMappings != null)
        {
            return _facesExtensionsFilterMappings;
        }

        List tempExtensionsFilterMappings = new ArrayList();
        for (Iterator it = _filters.entrySet().iterator(); it.hasNext(); )
        {
            Map.Entry entry = (Map.Entry)it.next();
            String filterName = (String)entry.getKey();
            String filterClassName = (String)entry.getValue();
            
            if (!"org.apache.myfaces.component.html.util.ExtensionsFilter".equals(filterClassName) &&
                !"org.apache.myfaces.webapp.filter.ExtensionsFilter".equals(filterClassName))
            {
                // not an extensions filter
                continue;
            }
            
            Class filterClass = org.apache.myfaces.shared.util.ClassUtils.simpleClassForName(filterClassName);
            List urlPatterns = (List)_filterMappings.get(filterName);
            if( urlPatterns != null )
            {
                for (Iterator it2 = urlPatterns.iterator(); it2.hasNext(); )
                {
                    String urlpattern = (String)it2.next();
                    tempExtensionsFilterMappings.add(new org.apache.myfaces.shared.webapp.webxml.FilterMapping(
                        filterName, filterClass, urlpattern));
                    if (log.isLoggable(Level.FINEST))
                    {
                        log.finest("adding mapping for filter + " + filterName + " urlpattern = " + urlpattern);
                    }
                }
            }
        }
        
        //Expose to all threads
        _facesExtensionsFilterMappings = tempExtensionsFilterMappings;
        
        return _facesExtensionsFilterMappings;
    }
780849
public List<String> paths(Node dir, Filter filter) throws IOException {
    	List<String> result;

    	result = new ArrayList<>();
    	paths(dir, filter, result);
    	return result;
    }
360522
public static HashMap<String, String> getUrlVariables(final Filter filter) {
        final HashMap<String, String> vars = new HashMap<String, String>();

        for (final FilterTag filterTag : filter.getFilterTags()) {
            final Tag tag = filterTag.getTag();
            final Integer tagState = filterTag.getTagState();

            if (tagState == CommonFilterConstants.MATCH_TAG_STATE) {
                vars.put(CommonFilterConstants.MATCH_TAG + tag.getTagId(), CommonFilterConstants.MATCH_TAG_STATE + "");
            } else if (tagState == CommonFilterConstants.NOT_MATCH_TAG_STATE) {
                vars.put(CommonFilterConstants.MATCH_TAG + tag.getTagId(), CommonFilterConstants.NOT_MATCH_TAG_STATE + "");
            } else if (tagState == CommonFilterConstants.GROUP_TAG_STATE) {
                vars.put(CommonFilterConstants.GROUP_TAG + tag.getTagId(), CommonFilterConstants.GROUP_TAG_STATE + "");
            }
        }

        for (final FilterCategory filterCategory : filter.getFilterCategories()) {
            final Category category = filterCategory.getCategory();
            final Project project = filterCategory.getProject();

            if (filterCategory.getCategoryState() == CommonFilterConstants.CATEGORY_INTERNAL_AND_STATE) {
                vars.put(
                        CommonFilterConstants.CATEORY_INTERNAL_LOGIC + category.getCategoryId() + (project == null ? "" : "-" + project
                                .getProjectId()),
                        CommonFilterConstants.AND_LOGIC);
            }

            // don't add a url var for the "or" internal logic, as this is the
            // default

            else if (filterCategory.getCategoryState() == CommonFilterConstants.CATEGORY_EXTERNAL_OR_STATE) {
                vars.put(
                        CommonFilterConstants.CATEORY_EXTERNAL_LOGIC + category.getCategoryId() + (project == null ? "" : "-" + project
                                .getProjectId()),
                        CommonFilterConstants.OR_LOGIC);
            }

            // don't add a url var for the "and" external logic, as this is the
            // default
        }

        int count = 1;
        for (final FilterLocale filterLocale : filter.getFilterLocales()) {
            final Integer localeState = filterLocale.getLocaleState();

            if (localeState == CommonFilterConstants.MATCH_TAG_STATE) {
                vars.put(CommonFilterConstants.MATCH_LOCALE + count, filterLocale.getLocaleName() + CommonFilterConstants.MATCH_TAG_STATE);
            } else if (localeState == CommonFilterConstants.NOT_MATCH_TAG_STATE) {
                vars.put(CommonFilterConstants.MATCH_LOCALE + count,
                        filterLocale.getLocaleName() + CommonFilterConstants.NOT_MATCH_TAG_STATE);
            }
            count++;
        }

        boolean foundFilterField = false;
        boolean foundFilterFieldLogic = false;
        for (final FilterField filterField : filter.getFilterFields()) {
            try {
                vars.put(filterField.getField(), URLEncoder.encode(filterField.getValue(), "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
            if (!filterField.getField().equals(CommonFilterConstants.LOGIC_FILTER_VAR)) foundFilterField = true;
            else foundFilterFieldLogic = true;
        }

        /*
         * if we have found some filter fields, but did not find the filter
         * logic, use the default value
         */
        if (foundFilterField && !foundFilterFieldLogic)
            vars.put(CommonFilterConstants.LOGIC_FILTER_VAR, FilterConstants.LOGIC_FILTER_VAR_DEFAULT_VALUE);

        return vars;
    }
159411
public static function get_currentUrl($filter = array(), $queryFilter = array(), $queryFilterMethod = 'remove')
    {
        if (!is_array($filter) && !empty($filter)) {
            $filter = array($filter);
        }

        if (!empty(self::$fakeCurrentUrl)) {
            $pageURL = self::$fakeCurrentUrl;
        } else {
            $pageURL = self::get_realCurrentUrl();
        }

        if (empty($filter) && empty($queryFilter)) {
            return $pageURL;
        }

        if (empty($filter)) {
            $filter = array('http', 'name', 'port', 'path', 'request');
        }

        $urlParts = parse_url($pageURL);

        if (!in_array('http', $filter)) {
            $pageURL = preg_replace('#.*://#', '', $pageURL);
        }

        if (!in_array('name', $filter) && !in_array('host', $filter) && array_key_exists('host', $urlParts)) {
            $pageURL = str_replace($urlParts['host'], '', $pageURL);
        }

        if (!in_array('port', $filter) && array_key_exists('port', $urlParts)) {
            $pageURL = str_replace(':'.$urlParts['port'], '', $pageURL);
        }
        
        if (!in_array('path', $filter) && array_key_exists('path', $urlParts)) {
            $pageURL = str_replace($urlParts['path'], '', $pageURL);
        }

        if ((in_array('request', $filter) || in_array('query', $filter)) && array_key_exists('query', $urlParts)) {
            if (!empty($queryFilter) && is_array($queryFilter)) {
                parse_str($urlParts['query'], $query);
                

                self::filter_data($query, $queryFilter, $queryFilterMethod);

                $pageURL = explode('?', $pageURL);

                if (empty($query)) {
                    unset($pageURL[1]);
                } else {
                    $pageURL[1] = http_build_query($query);
                }

                $pageURL = implode('?', $pageURL);
            }
        } else {
            $pageURL = preg_replace('/\?.*/', '', $pageURL);
        }

        return $pageURL;
    }
932145
public static File[] findRecycledJournalFiles( String baseName , File dataFolder )
    {
    	final String journalBase = baseName+JournalFile.SUFFIX;
    	File[] recycledFiles = dataFolder.listFiles(new FileFilter() {
			/*
			 * (non-Javadoc)
			 * @see java.io.FileFilter#accept(java.io.File)
			 */
			@Override
			public boolean accept(File pathname)
			{
				if (!pathname.isFile())
					return false;
				
				return pathname.getName().startsWith(journalBase) &&
				       pathname.getName().endsWith(JournalFile.RECYCLED_SUFFIX);
			}
		});
    	
    	return recycledFiles;
    }
1215499
public static vpath[] get_filtered(nitro_service service, String filter) throws Exception{
		vpath obj = new vpath();
		options option = new options();
		option.set_filter(filter);
		vpath[] response = (vpath[]) obj.getfiltered(service, option);
		return response;
	}
576348
@Override
    public Map<ArchivePath, Node> getContent(Filter<ArchivePath> filter) {
        Validate.notNull(filter, "Filter must be specified");

        Map<ArchivePath, Node> filteredContent = new LinkedHashMap<ArchivePath, Node>();
        for (Map.Entry<ArchivePath, NodeImpl> contentEntry : content.entrySet()) {
            if (filter.include(contentEntry.getKey())) {
                if (!contentEntry.getKey().equals(new BasicPath("/"))) {
                    filteredContent.put(contentEntry.getKey(), contentEntry.getValue());
                }
            }
        }
        return filteredContent;
    }
395316
public function getOrphanedPages($class = SiteTree::class, $filter = array(), $sort = null, $join = null, $limit = null)
    {
        // Alter condition
        $table = DataObject::getSchema()->tableName($class);
        if (empty($filter)) {
            $where = array();
        } elseif (is_array($filter)) {
            $where = $filter;
        } else {
            $where = array($filter);
        }
        $where[] = array("\"{$table}\".\"ParentID\" != ?" => 0);
        $where[] = '"Parents"."ID" IS NULL';

        $orphans = new ArrayList();
        foreach (array(Versioned::DRAFT, Versioned::LIVE) as $stage) {
            $table .= ($stage == Versioned::LIVE) ? '_Live' : '';
            $stageOrphans = Versioned::get_by_stage(
                $class,
                $stage,
                $where,
                $sort,
                null,
                $limit
            )->leftJoin($table, "\"$table\".\"ParentID\" = \"Parents\".\"ID\"", "Parents");
            $orphans->merge($stageOrphans);
        }

        $orphans->removeDuplicates();

        return $orphans;
    }
442327
public boolean searchBase(String base, String filter) throws NamingException {
    return search(base, filter, scopeBase);
  }
751372
public List<FilterType<PortletAppType<T>>> getAllFilter()
   {
      List<FilterType<PortletAppType<T>>> list = new ArrayList<FilterType<PortletAppType<T>>>();
      List<Node> nodeList = childNode.get("filter");
      for(Node node: nodeList)
      {
         FilterType<PortletAppType<T>>  type = new FilterTypeImpl<PortletAppType<T>>(this, "filter", childNode, node);
         list.add(type);
      }
      return list;
   }
1124460
public Collection<Link> links(LinkFilter filter) {
        return get(Link.class, (filter != null) ? filter : new LinkFilter());
    }
1322754
public boolean matchesFilter(String filter) {

        filter = filter.toLowerCase();
        return m_title.toLowerCase().contains(filter) || m_path.toLowerCase().contains(filter);
    }