use of com.enonic.xp.query.filter.BooleanFilter in project xp by enonic.
the class SetPublishInfoCommand method findNodesWithoutPublishFirstAndFrom.
private NodeIds findNodesWithoutPublishFirstAndFrom(final NodeIds nodesToPush) {
if (nodesToPush.isEmpty()) {
return NodeIds.empty();
}
final BooleanFilter containPublishFirstAndFromFilter = BooleanFilter.create().must(ExistsFilter.create().fieldName(ContentIndexPath.PUBLISH_FIRST.getPath()).build()).must(ExistsFilter.create().fieldName(ContentIndexPath.PUBLISH_FROM.getPath()).build()).build();
final NodeQuery query = NodeQuery.create().addQueryFilter(BooleanFilter.create().mustNot(containPublishFirstAndFromFilter).must(IdFilter.create().fieldName(ContentIndexPath.ID.getPath()).values(nodesToPush).build()).build()).size(NodeQuery.ALL_RESULTS_SIZE_FLAG).build();
final FindNodesByQueryResult result = this.nodeService.findByQuery(query);
return result.getNodeIds();
}
Aggregations