use of org.craftercms.core.service.impl.CompositeItemFilter 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;
}
}
use of org.craftercms.core.service.impl.CompositeItemFilter in project engine by craftercms.
the class SiteItemServiceImpl method getSiteTree.
@Override
public SiteItem getSiteTree(String url, int depth, ItemFilter filter, ItemProcessor processor) {
if (CollectionUtils.isNotEmpty(defaultFilters)) {
CompositeItemFilter compositeFilter = new CompositeItemFilter(new ArrayList<>(defaultFilters));
if (filter != null) {
compositeFilter.addFilter(filter);
}
filter = compositeFilter;
}
if (CollectionUtils.isNotEmpty(defaultProcessors)) {
ItemProcessorPipeline processorPipeline = new ItemProcessorPipeline(new ArrayList<>(defaultProcessors));
if (processor != null) {
processorPipeline.addProcessor(processor);
}
processor = processorPipeline;
}
Tree tree = storeService.findTree(getSiteContext().getContext(), null, url, depth, filter, processor);
if (tree != null) {
return createItemWrapper(tree);
} else {
return null;
}
}
Aggregations