/** * 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(); }
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(); }
private Builder() { description(DEFAULT_DESCRIPTION); }
private Builder() { description(DEFAULT_DESCRIPTION); }
@Override protected DittoRuntimeExceptionBuilder<? extends DittoRuntimeException> getEmptyBuilder() { return new Builder(); }
@Override protected DittoRuntimeExceptionBuilder<? extends DittoRuntimeException> getEmptyBuilder() { return new Builder(); }
/** * Constructs a new {@code InvalidRqlExpressionException} object with given message. * * @param message detail message. This message can be later retrieved by the {@link #getMessage()} method. * @param dittoHeaders the headers of the command which resulted in this exception. * @return the new InvalidRqlExpressionException. */ public static InvalidRqlExpressionException fromMessage(final String message, final DittoHeaders dittoHeaders) { return new Builder() .dittoHeaders(dittoHeaders) .message(message) .build(); }
/** * Constructs a new {@code InvalidRqlExpressionException} object with given message. * * @param message detail message. This message can be later retrieved by the {@link #getMessage()} method. * @param dittoHeaders the headers of the command which resulted in this exception. * @return the new InvalidRqlExpressionException. */ public static InvalidRqlExpressionException fromMessage(final String message, final DittoHeaders dittoHeaders) { return new Builder() .dittoHeaders(dittoHeaders) .message(message) .build(); }
/** * A mutable builder for a {@code InvalidRqlExpressionException}. * * @return the builder. */ public static Builder newBuilder() { return new Builder(); }
/** * A mutable builder for a {@code InvalidRqlExpressionException}. * * @return the builder. */ public static Builder newBuilder() { return new Builder(); }