private void assertHasParameter(Query query, String parameterName, String... rawValues) { assertThat(query.hasParameter(parameterName),equalTo(true)); Parameter parameter = query.getParameter(parameterName); assertThat(parameter,notNullValue()); assertThat(parameter.isMultivalued(),equalTo(rawValues.length>1)); assertThat(parameter.cardinality(),equalTo(rawValues.length)); assertThat(parameter.rawValue(),equalTo(rawValues[0])); assertThat(parameter.rawValues(),hasItems(rawValues)); }
throw new InvalidQueryException("Could not understand: '"+failure.rawValue()+"' is not a valid boolean value for parameter '"+QueryableResourceHandler.FAILURE+"'",e,query);
private Response handleConstraintReportRetrieval(OperationContext context, boolean includeEntity, Variant variant) { Parameter parameter=RetrievalScenario.constraintReportId(context); if(parameter.cardinality()!=1) { throw new InvalidConstraintReportRetrievalException(context,parameter.rawValues(),includeEntity); } String constraintReportId = parameter.rawValue(); try { LOGGER.debug("Retrieving constraint report: {}",constraintReportId); PublicResource resource=context.resource(); DataSet report=resource.getConstraintReport(constraintReportId); if(report==null) { throw new UnknownConstraintReportException(context,constraintReportId,includeEntity); } LOGGER.trace("Constraint report to serialize:\n{}",report); return prepareConstraintReportRetrievalResponse(context,variant,report,includeEntity); } catch (ApplicationExecutionException e) { throw diagnoseApplicationExecutionException(context, e); } catch (ApplicationContextException e) { throw new InternalServerException(context,e); } }