@Override protected InvalidRqlExpressionException doBuild(final DittoHeaders dittoHeaders, final String message, final String description, final Throwable cause, final URI href) { return new InvalidRqlExpressionException(dittoHeaders, message, description, cause, href); } }
/** * Constructs a new {@code InvalidRqlExpressionException} object with the exception message extracted from the * given JSON object. * * @param jsonObject the JSON to read the {@link JsonFields#MESSAGE} field from. * @param dittoHeaders the headers of the command which resulted in this exception. * @return the new InvalidRqlExpressionException. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the {@code jsonObject} does not have the {@link * JsonFields#MESSAGE} field. */ public static InvalidRqlExpressionException fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new Builder() .dittoHeaders(dittoHeaders) .message(readMessage(jsonObject)) .description(readDescription(jsonObject).orElse(DEFAULT_DESCRIPTION)) .href(readHRef(jsonObject).orElse(null)) .build(); }
@Override public Void visitNor(final Stream<Void> negativeDisjoints) { if (norIsForbidden) { final String message = String.format("The filter operation 'not' is not available in API versions >= %d. " + "Please rephrase your search query without using 'not'.", getForbiddenSchemaVersion()); throw InvalidRqlExpressionException.fromMessage(message, dittoHeaders); } else { // force the stream to evaluate criteria on children negativeDisjoints.count(); return null; } }
private Criteria mapCriteria(final String filter, final DittoHeaders dittoHeaders) { try { final ParameterPredicateVisitor visitor = new ParameterPredicateVisitor(criteriaFactory, fieldExpressionFactory); final RootNode rootNode = rqlPredicateParser.parse(filter); visitor.visit(rootNode); final Criteria criteria; if (visitor.getCriteria().size() > 1) { criteria = criteriaFactory.and(visitor.getCriteria()); } else if (visitor.getCriteria().size() == 1) { criteria = visitor.getCriteria().get(0); } else { criteria = criteriaFactory.any(); } return criteria; } catch (final ParserException | IllegalArgumentException e) { throw InvalidRqlExpressionException.newBuilder() .message(e.getMessage()) .cause(e) .dittoHeaders(dittoHeaders) .build(); } } }
/** * Constructs a new {@code InvalidRqlExpressionException} object with the exception message extracted from the * given JSON object. * * @param jsonObject the JSON to read the {@link JsonFields#MESSAGE} field from. * @param dittoHeaders the headers of the command which resulted in this exception. * @return the new InvalidRqlExpressionException. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the {@code jsonObject} does not have the {@link * JsonFields#MESSAGE} field. */ public static InvalidRqlExpressionException fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new Builder() .dittoHeaders(dittoHeaders) .message(readMessage(jsonObject)) .description(readDescription(jsonObject).orElse(DEFAULT_DESCRIPTION)) .href(readHRef(jsonObject).orElse(null)) .build(); }
@Override protected InvalidRqlExpressionException doBuild(final DittoHeaders dittoHeaders, final String message, final String description, final Throwable cause, final URI href) { return new InvalidRqlExpressionException(dittoHeaders, message, description, cause, href); } }