query.executable();
}
if (timers != null && timers) {
if (messages != null && messages) {
throw new InvalidRequestException(Status.BAD_REQUEST, "Parameter timers cannot be used together with parameter messages.");
}
query.timers();
}
if (messages != null && messages) {
if (timers != null && timers) {
throw new InvalidRequestException(Status.BAD_REQUEST, "Parameter messages cannot be used together with parameter timers.");
}
query.messages();
}
if (withException != null && withException) {
query.withException();
}
if (exceptionMessage != null) {
query.exceptionMessage(exceptionMessage);
}
if (noRetriesLeft != null && noRetriesLeft) {
query.noRetriesLeft();
}
if (active != null && active) {
query.active();
}
if (suspended != null && suspended) {
query.suspended();
}
if (dueDates != null) {
DateConverter dateConverter = new DateConverter();
dateConverter.setObjectMapper(objectMapper);
for (ConditionQueryParameterDto conditionQueryParam : dueDates) {
String op = conditionQueryParam.getOperator();
Date dueDate = null;
try {
dueDate = dateConverter.convertQueryParameterToType((String) conditionQueryParam.getValue());
} catch (RestException e) {
throw new InvalidRequestException(e.getStatus(), e, "Invalid due date format: " + e.getMessage());
}
if (op.equals(ConditionQueryParameterDto.GREATER_THAN_OPERATOR_NAME)) {
query.duedateHigherThan(dueDate);
} else if (op.equals(ConditionQueryParameterDto.LESS_THAN_OPERATOR_NAME)) {
query.duedateLowerThan(dueDate);
} else {
throw new InvalidRequestException(Status.BAD_REQUEST, "Invalid due date comparator specified: " + op);
}
}
}
}