Search in sources :

Example 1 with ExcludeByNameItemFilter

use of org.craftercms.engine.service.filter.ExcludeByNameItemFilter in project engine by craftercms.

the class SiteItemServiceImpl method getSiteTree.

@Deprecated
@Override
public SiteItem getSiteTree(String url, int depth, String includeByNameRegex, String excludeByNameRegex, Map<String, String> nodeXPathAndExpectedValuePairs) {
    CompositeItemFilter compositeFilter = new CompositeItemFilter();
    if (CollectionUtils.isNotEmpty(defaultFilters)) {
        for (ItemFilter defaultFilter : defaultFilters) {
            compositeFilter.addFilter(defaultFilter);
        }
    }
    if (StringUtils.isNotEmpty(includeByNameRegex)) {
        compositeFilter.addFilter(new IncludeByNameItemFilter(includeByNameRegex));
    }
    if (StringUtils.isNotEmpty(excludeByNameRegex)) {
        compositeFilter.addFilter(new ExcludeByNameItemFilter(excludeByNameRegex));
    }
    if (MapUtils.isNotEmpty(nodeXPathAndExpectedValuePairs)) {
        for (Map.Entry<String, String> pair : nodeXPathAndExpectedValuePairs.entrySet()) {
            compositeFilter.addFilter(new ExpectedNodeValueItemFilter(pair.getKey(), pair.getValue()));
        }
    }
    Tree tree = storeService.findTree(getSiteContext().getContext(), null, url, depth, compositeFilter, null);
    if (tree != null) {
        return createItemWrapper(tree);
    } else {
        return null;
    }
}
Also used : ExpectedNodeValueItemFilter(org.craftercms.engine.service.filter.ExpectedNodeValueItemFilter) CompositeItemFilter(org.craftercms.core.service.impl.CompositeItemFilter) IncludeByNameItemFilter(org.craftercms.engine.service.filter.IncludeByNameItemFilter) ExcludeByNameItemFilter(org.craftercms.engine.service.filter.ExcludeByNameItemFilter) ItemFilter(org.craftercms.core.service.ItemFilter) ExpectedNodeValueItemFilter(org.craftercms.engine.service.filter.ExpectedNodeValueItemFilter) ExcludeByNameItemFilter(org.craftercms.engine.service.filter.ExcludeByNameItemFilter) Tree(org.craftercms.core.service.Tree) CompositeItemFilter(org.craftercms.core.service.impl.CompositeItemFilter) IncludeByNameItemFilter(org.craftercms.engine.service.filter.IncludeByNameItemFilter) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 ItemFilter (org.craftercms.core.service.ItemFilter)1 Tree (org.craftercms.core.service.Tree)1 CompositeItemFilter (org.craftercms.core.service.impl.CompositeItemFilter)1 ExcludeByNameItemFilter (org.craftercms.engine.service.filter.ExcludeByNameItemFilter)1 ExpectedNodeValueItemFilter (org.craftercms.engine.service.filter.ExpectedNodeValueItemFilter)1 IncludeByNameItemFilter (org.craftercms.engine.service.filter.IncludeByNameItemFilter)1