use of com.enonic.xp.query.expr.QueryExpr in project xp by enonic.
the class FindUsersHandler method execute.
public PrincipalsResultMapper execute() {
final ConstraintExpr constraintExpr = QueryParser.parseCostraintExpression(this.query == null ? "" : this.query);
final List<OrderExpr> orderExpressions = QueryParser.parseOrderExpressions(this.sort == null ? "" : this.sort);
final QueryExpr queryExpr = QueryExpr.from(constraintExpr, orderExpressions);
final UserQuery userQuery = UserQuery.create().from(this.start).size(this.count).queryExpr(queryExpr).build();
final UserQueryResult result = this.securityService.get().query(userQuery);
return new PrincipalsResultMapper(result.getUsers(), result.getTotalSize(), this.includeProfile);
}
use of com.enonic.xp.query.expr.QueryExpr in project xp by enonic.
the class QueryContentHandler method doExecute.
@Override
protected Object doExecute() {
final int start = valueOrDefault(this.start, 0);
final int count = valueOrDefault(this.count, GetChildContentHandler.DEFAULT_COUNT);
final ContentTypeNames contentTypeNames = getContentTypeNames();
final QueryExpr queryExpr = QueryExpr.from(buildConstraintExpr(), buildOrderExpr());
final Filters filters = JsonToFilterMapper.create(this.filters);
final Set<AggregationQuery> aggregations = new QueryAggregationParams().getAggregations(this.aggregations);
final HighlightQuery highlight = new QueryHighlightParams().getHighlightQuery(this.highlight);
final ContentQuery.Builder queryBuilder = ContentQuery.create().from(start).size(count).aggregationQueries(aggregations).highlight(highlight).addContentTypeNames(contentTypeNames).queryExpr(queryExpr);
for (final Filter filter : filters) {
queryBuilder.queryFilter(filter);
}
final FindContentIdsByQueryResult queryResult = contentService.find(queryBuilder.build());
return convert(queryResult);
}
use of com.enonic.xp.query.expr.QueryExpr in project xp by enonic.
the class AbstractFindNodesQueryHandler method createNodeQuery.
NodeQuery createNodeQuery() {
final int start = valueOrDefault(this.start, 0);
final int count = valueOrDefault(this.count, 10);
final QueryExpr queryExpr = QueryExpr.from(buildConstraintExpr(), buildOrderExpr());
final Filters filters = JsonToFilterMapper.create(this.filters);
final AggregationQueries aggregations = new QueryAggregationParams().getAggregations(this.aggregations);
final SuggestionQueries suggestions = new QuerySuggestionParams().getSuggestions(this.suggestions);
final HighlightQuery highlight = new QueryHighlightParams().getHighlightQuery(this.highlight);
return NodeQuery.create().from(start).size(count).addAggregationQueries(aggregations).addSuggestionQueries(suggestions).highlight(highlight).query(queryExpr).addQueryFilters(filters).explain(this.explain).build();
}
Aggregations