/** * query options are pairs of key/value. Ensure that the number of args is even * * @throws IllegalArgumentException */ @Override public void validate() throws IllegalArgumentException { if (this.parameterList.isEmpty()) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
qd.logic = queryLogicFactory.getQueryLogic(queryLogicName, ctx.getCallerPrincipal()); } catch (Exception e) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.QUERY_LOGIC_ERROR, e); GenericResponse<String> response = new GenericResponse<>(); response.addException(qe.getBottomQueryException()); throw new BadRequestException(qe, response); marking.validate(queryParameters); } catch (IllegalArgumentException e) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.SECURITY_MARKING_CHECK_ERROR, e); GenericResponse<String> response = new GenericResponse<>(); response.addException(qe); BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.PAGE_SIZE_TOO_LARGE, MessageFormat.format("Max = {0}.", qd.logic.getMaxPageSize())); GenericResponse<String> response = new GenericResponse<>();
/** * query options are pairs of key/value. Ensure that the number of args is even * * @throws IllegalArgumentException */ @Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() % 2 != 0) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() != 1) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() != 3) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() != 5) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() != 2) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() < 2) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
/** * query options are pairs of key/value. Ensure that the number of args is even * * @throws IllegalArgumentException */ @Override public void validate() throws IllegalArgumentException { if (this.parameterList.isEmpty()) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() != 1) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() != 1) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } if (this.depth != 1) { throw new IllegalArgumentException("function: " + this.name + " must be at the top level of the query"); } if (!(this.parent instanceof AndQueryNode || this.parent instanceof BooleanQueryNode)) { throw new IllegalArgumentException("function: " + this.name + " must be part of an AND expression"); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() % 2 != 0) { // must have even number of args BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } if (this.depth != 1) { throw new IllegalArgumentException("function: " + this.name + " must be at the top level of the query"); } if (!(this.parent instanceof AndQueryNode || this.parent instanceof BooleanQueryNode)) { throw new IllegalArgumentException("function: " + this.name + " must be part of an AND expression"); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() % 2 != 0) { // must have even number of args BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } if (this.depth != 1) { throw new IllegalArgumentException("function: " + this.name + " must be at the top level of the query"); } if (!(this.parent instanceof AndQueryNode || this.parent instanceof BooleanQueryNode)) { throw new IllegalArgumentException("function: " + this.name + " must be part of an AND expression"); } }
@Override public void validate() throws IllegalArgumentException { if (this.depth != 1) { throw new IllegalArgumentException("function: " + this.name + " must be at the top level of the query"); } if ((this.parent instanceof AndQueryNode) == false) { throw new IllegalArgumentException("function: " + this.name + " must be part of an AND expression"); } if (this.parameterList.size() < 2 || this.depth != 1) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() != 1) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } if (this.depth != 1) { throw new IllegalArgumentException("function: " + this.name + " must be at the top level of the query"); } if (!(this.parent instanceof AndQueryNode || this.parent instanceof BooleanQueryNode)) { throw new IllegalArgumentException("function: " + this.name + " must be part of an AND expression"); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() % 2 != 0) { // must have even number of args BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } if (this.depth != 1) { throw new IllegalArgumentException("function: " + this.name + " must be at the top level of the query"); } if (!(this.parent instanceof AndQueryNode || this.parent instanceof BooleanQueryNode)) { throw new IllegalArgumentException("function: " + this.name + " must be part of an AND expression"); } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() < 2) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } if (this.parameterList.size() % 2 != 0) { // odd number of args String shouldBeANumber = parameterList.get(this.parameterList.size() - 1); // get the last arg try { Integer.parseInt(shouldBeANumber); } catch (Exception ex) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", ex, this.name)); throw new IllegalArgumentException(qe); } } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() < 2) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } String firstArg = this.parameterList.get(0); if (firstArg.equalsIgnoreCase("and") || firstArg.equalsIgnoreCase("or")) { if (this.parameterList.size() % 2 != 1) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } } else { if (this.parameterList.size() % 2 != 0) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() < 2) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } if (this.parameterList.size() % 2 != 0) { // odd number of args String shouldBeANumber = parameterList.get(this.parameterList.size() - 1); // get the last arg try { Integer.parseInt(shouldBeANumber); } catch (Exception ex) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", ex, this.name)); throw new IllegalArgumentException(qe); } } }
@Override public void validate() throws IllegalArgumentException { if (this.parameterList.size() < 2) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", this.name)); throw new IllegalArgumentException(qe); } if (this.parameterList.size() % 2 != 0) { // odd number of args String shouldBeANumber = parameterList.get(this.parameterList.size() - 1); // get the last arg try { Integer.parseInt(shouldBeANumber); } catch (Exception ex) { BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", ex, this.name)); throw new IllegalArgumentException(qe); } } }