protected void checkReservedCharacter(String value, String parameterName) throws OwsExceptionReport { if (value != null && value.contains(",")) { throw new InvalidParameterValueException(parameterName, value) .withMessage("The value '%s' contains the reserved parameter ','", value); } }
public static String checkParameterSingleValue(String value, String name) throws OwsExceptionReport { if (checkParameterMultipleValues(value, name).size() == 1) { return value; } else { throw new InvalidParameterValueException(name, value); } }
private void checkResponseFormat(String responseFormat) throws CodedOwsException { if (responseFormat == null || responseFormat.isEmpty()) { throw new MissingParameterValueException("responseFormat"); } if (!(GetDataAvailabilityConstants.NS_GDA.equals(responseFormat) || GetDataAvailabilityConstants.NS_GDA_20.equals(responseFormat))) { throw new InvalidParameterValueException("responseFormat", responseFormat); } }
protected Date getDateForTimeIndeterminateValue(IndeterminateValue indeterminateValue, String parameter) throws InvalidParameterValueException { if (indeterminateValue.isNow()) { return new DateTime().toDate(); } throw new InvalidParameterValueException(parameter, indeterminateValue.getValue()); }
private static OwsExceptionReport duplicateOutput(OwsCode id) { return new InvalidParameterValueException().at(OUTPUT).withMessage("Duplicate output definition for output %s", id); }
protected void checkTransactionalProcedureID(String procedure, String parameterName) throws OwsExceptionReport { if (Strings.isNullOrEmpty(procedure)) { throw new MissingProcedureParameterException(); } else if (!getCache().hasTransactionalObservationProcedure(procedure)) { throw new InvalidParameterValueException(parameterName, procedure); } }
protected void checkQueryableProcedureID(String procedure, String parameterName) throws OwsExceptionReport { if (Strings.isNullOrEmpty(procedure)) { throw new MissingProcedureParameterException(); } else if (!getCache().hasQueryableProcedure(procedure)) { throw new InvalidParameterValueException(parameterName, procedure); } }
protected void checkTransactionalProcedure(String procedure, String parameterName) throws OwsExceptionReport { if (Strings.isNullOrEmpty(procedure)) { throw new MissingProcedureParameterException(); } else if (!getCache().hasTransactionalObservationProcedure(procedure)) { throw new InvalidParameterValueException(parameterName, procedure); } }
protected void checkQueryableProcedure(String procedure, String parameterName) throws OwsExceptionReport { if (Strings.isNullOrEmpty(procedure)) { throw new MissingProcedureParameterException(); } else if (!getCache().hasQueryableProcedure(procedure)) { throw new InvalidParameterValueException(parameterName, procedure); } }
protected void checkObservationType(String observationType, String parameterName) throws OwsExceptionReport { if (observationType == null || observationType.isEmpty()) { throw new MissingParameterValueException(parameterName); } else if (!getCache().hasObservationType(observationType)) { throw new InvalidParameterValueException(parameterName, observationType); } }
protected void checkResultTemplate(String resultTemplate, String parameterName) throws OwsExceptionReport { if (resultTemplate == null || resultTemplate.isEmpty()) { throw new MissingParameterValueException(parameterName); } else if (!getCache().hasResultTemplate(resultTemplate)) { throw new InvalidParameterValueException(parameterName, resultTemplate); } }
protected boolean checkOnlyRequestableProcedureDescriptionFromats(String format, Enum<?> parameter, boolean mimeTypeAllowed) throws CodedOwsException { if (Strings.isNullOrEmpty(format)) { throw new MissingParameterValueException(parameter); } else { if (!mimeTypeAllowed && !format.startsWith("http://")) { throw new InvalidParameterValueException(parameter, format); } return getCache().hasRequestableProcedureDescriptionFormat(format) ? true : hasPossibleProcedureDescriptionFormats(format, mimeTypeAllowed); } }
private Optional<OwsExceptionReport> checkIdentifier(OwsCode id) { if (id == null) { return Optional.of(new MissingParameterValueException(IDENTIFIER)); } if (!isAll(id) && !getEngine().hasProcessDescription(id)) { return Optional.of(new InvalidParameterValueException(IDENTIFIER, id.getValue())); } return Optional.empty(); }
public static URI checkParameterSingleURI(String values, String name) throws OwsExceptionReport { String value = checkParameterSingleValue(values, name); try { return new URI(value); } catch (URISyntaxException e) { throw new InvalidParameterValueException().at(name).causedBy(e) .withMessage("Cannot parse provided value '%s' to URI", value); } }
private static OwsExceptionReport invalidInput(ProcessData input, String messageDetail) { String id = input.getId().getValue(); return new InvalidParameterValueException().at(INPUT).withMessage(VALUE_INVALID, id, INPUT, messageDetail); }
private static OwsExceptionReport invalidOutput(OutputDefinition output, String messageDetail) { String id = output.getId().getValue(); return new InvalidParameterValueException().at(OUTPUT).withMessage(VALUE_INVALID, id, OUTPUT, messageDetail); }
@Override public void validate(AbstractJobIdRequest request) throws OwsExceptionReport { JobId jobId = request.getJobId(); if (jobId == null || jobId.getValue() == null || jobId.getValue().isEmpty()) { throw new MissingParameterValueException(JOB_ID); } if (!getEngine().hasJob(jobId)) { throw new InvalidParameterValueException(JOB_ID, jobId.getValue()); } }
private void createStaticCapabilitiesWithId(GetCapabilitiesRequest request, GetCapabilitiesResponse response) throws OwsExceptionReport { StaticCapabilities sc = this.capabilitiesExtensionService.getStaticCapabilities(request.getCapabilitiesId()); if (sc == null) { throw new InvalidParameterValueException(GetCapabilitiesParams.CapabilitiesId, request.getCapabilitiesId()); } response.setXmlString(sc.getDocument()); }
private void checkResultTemplates(DeleteResultTemplateRequest request, CompositeOwsException exceptions) { if (request.isSetResultTemplates()) { for (String resultTemplate : request.getResultTemplates()) { if (!getCache().hasResultTemplate(resultTemplate)) { exceptions.add(new InvalidParameterValueException( DeleteResultTemplateConstants.PARAMETERS.resultTemplate, resultTemplate)); } } } }
private void checkProcedureAndOfferingCombination(InsertSensorRequest request) throws OwsExceptionReport { for (SosOffering offering : request.getAssignedOfferings()) { if (!offering.isParentOffering() && getCache().getPublishedOfferings().contains(offering.getIdentifier())) { throw new InvalidParameterValueException().at(Sos2Constants.InsertSensorParams.offeringIdentifier) .withMessage( "The offering with the identifier '%s' still exists in this service and it is not allowed to insert more than one procedure to an offering!", offering.getIdentifier()); } } }