use of com.enonic.xp.repo.impl.version.search.ExcludeEntry in project xp by enonic.
the class DiffQueryFactory method wrapInPathQueryIfNecessary.
private FilteredQueryBuilder wrapInPathQueryIfNecessary(final BoolQueryBuilder sourceTargetCompares) {
final BoolQueryBuilder pathFilter = new BoolQueryBuilder();
boolean addedPathFilter = false;
if (this.nodePath != null && !this.nodePath.isRoot()) {
addedPathFilter = true;
pathFilter.must(hasPath(this.nodePath, true));
}
if (!this.excludes.isEmpty()) {
addedPathFilter = true;
for (final ExcludeEntry exclude : excludes) {
pathFilter.mustNot(hasPath(exclude.getNodePath(), exclude.isRecursive()));
}
}
return addedPathFilter ? new FilteredQueryBuilder(pathFilter, sourceTargetCompares) : new FilteredQueryBuilder(QueryBuilders.matchAllQuery(), sourceTargetCompares);
}
use of com.enonic.xp.repo.impl.version.search.ExcludeEntry in project xp by enonic.
the class FindNodesWithVersionDifferenceCommand method getExcludePaths.
private ExcludeEntries getExcludePaths(final InternalContext context) {
if (this.excludes.isEmpty()) {
return ExcludeEntries.empty();
}
final ExcludeEntries.Builder builder = ExcludeEntries.create();
final NodeBranchEntries result = this.nodeStorageService.getBranchNodeVersions(excludes, false, context);
for (final NodeBranchEntry entry : result) {
builder.add(new ExcludeEntry(entry.getNodePath(), false));
}
return builder.build();
}
use of com.enonic.xp.repo.impl.version.search.ExcludeEntry in project xp by enonic.
the class HasUnpublishedChildrenCommand method execute.
public boolean execute() {
final Node parentNode = doGetById(parent);
if (parentNode == null) {
return false;
}
final SearchResult result = nodeSearchService.query(NodeVersionDiffQuery.create().source(ContextAccessor.current().getBranch()).target(target).nodePath(parentNode.path()).size(0).excludes(ExcludeEntries.create().add(new ExcludeEntry(parentNode.path(), false)).build()).build(), SingleRepoStorageSource.create(ContextAccessor.current().getRepositoryId(), SingleRepoStorageSource.Type.VERSION));
return result.getTotalHits() > 0;
}
Aggregations