@Override protected boolean isValid(SosContentCache cache, String id) { return cache.hasObservableProperty(id); }
@Override protected boolean isValid(SosContentCache cache, String id) { return cache.hasObservableProperty(id); }
@ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(method = RequestMethod.POST) public void change(@RequestParam(OLD_IDENTIFIER_REQUEST_PARAM) String oldName, @RequestParam(NEW_IDENTIFIER_REQUEST_PARAM) String newName) throws NoSuchObservablePropertyException, NoImplementationFoundException, AlreadyUsedIdentifierException, OwsExceptionReport { log.info("Changing observable property: {} -> {}", oldName, newName); SosContentCache cache = getCache(); if (!cache.hasObservableProperty(oldName)) { throw new NoSuchObservablePropertyException(oldName); } if (cache.hasObservableProperty(newName)) { throw new AlreadyUsedIdentifierException(newName); } if (!this.dao.isPresent()) { throw new NoImplementationFoundException(RenameDAO.class); } this.dao.get().renameObservableProperty(oldName, newName); updateCache(); }
@ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(method = RequestMethod.POST) public void change(@RequestParam(OLD_IDENTIFIER_REQUEST_PARAM) String oldName, @RequestParam(NEW_IDENTIFIER_REQUEST_PARAM) String newName) throws NoSuchObservablePropertyException, NoImplementationFoundException, AlreadyUsedIdentifierException, OwsExceptionReport { log.info("Changing observable property: {} -> {}", oldName, newName); SosContentCache cache = getCache(); if (!cache.hasObservableProperty(oldName)) { throw new NoSuchObservablePropertyException(oldName); } if (cache.hasObservableProperty(newName)) { throw new AlreadyUsedIdentifierException(newName); } if (!this.dao.isPresent()) { throw new NoImplementationFoundException(RenameDAO.class); } this.dao.get().renameObservableProperty(oldName, newName); updateCache(); }
private boolean checkComponentsIfInserted(List<OmObservableProperty> phenomenonComponents) { for (OmObservableProperty omObservableProperty : phenomenonComponents) { if (getCache().hasObservableProperty(omObservableProperty.getIdentifier()) && !getCache() .getProceduresForObservableProperty(omObservableProperty.getIdentifier()).isEmpty()) { return true; } } return false; }
private boolean checkComponentsIfInserted(List<OmObservableProperty> phenomenonComponents) { for (OmObservableProperty omObservableProperty : phenomenonComponents) { if (getCache().hasObservableProperty(omObservableProperty.getIdentifier()) && !getCache() .getProceduresForObservableProperty(omObservableProperty.getIdentifier()).isEmpty()) { return true; } } return false; }
private void checkObservedPropertyOfferingPairs(DeleteResultTemplateRequest request, CompositeOwsException exceptions) { if (request.isSetObservedPropertyOfferingPairs()) { for (Map.Entry<String, String> propertyOfferingPair : request.getObservedPropertyOfferingPairs()) { if (!getCache().hasOffering(propertyOfferingPair.getValue())) { exceptions.add(new InvalidParameterValueException( DeleteResultTemplateConstants.PARAMETERS.offering, propertyOfferingPair.getValue())); } if (!getCache().hasObservableProperty(propertyOfferingPair.getKey())) { exceptions.add(new InvalidParameterValueException( DeleteResultTemplateConstants.PARAMETERS.observableProperty, propertyOfferingPair.getKey())); } } } }
private void checkObservedPropertyOfferingPairs(DeleteResultTemplateRequest request, CompositeOwsException exceptions) { if (request.isSetObservedPropertyOfferingPairs()) { for (Map.Entry<String, String> propertyOfferingPair : request.getObservedPropertyOfferingPairs()) { if (!getCache().hasOffering(propertyOfferingPair.getValue())) { exceptions.add(new InvalidParameterValueException( DeleteResultTemplateConstants.PARAMETERS.offering, propertyOfferingPair.getValue())); } if (!getCache().hasObservableProperty(propertyOfferingPair.getKey())) { exceptions.add(new InvalidParameterValueException( DeleteResultTemplateConstants.PARAMETERS.observableProperty, propertyOfferingPair.getKey())); } } } }
protected void checkObservedProperty(String observedProperty, String parameterName, boolean insertion) throws OwsExceptionReport { if (observedProperty == null || observedProperty.isEmpty()) { throw new MissingParameterValueException(parameterName); } if (insertion) { if (!getCache().hasObservableProperty(observedProperty)) { throw new InvalidParameterValueException(parameterName, observedProperty); } } else if (isIncludeChildObservableProperties()) { if (getCache().isCompositePhenomenon(observedProperty) || !(getCache().isCompositePhenomenonComponent(observedProperty) || getCache().hasObservableProperty(observedProperty))) { throw new InvalidParameterValueException(parameterName, observedProperty); } } else if (!getCache().getPublishedObservableProperties().contains(observedProperty)) { throw new InvalidParameterValueException(parameterName, observedProperty); } }