@Override public boolean hasExtendedOfferingFor(String identifier) { return this.enabled && getCache().getOfferings().contains(identifier); }
@Override public boolean hasExtendedOfferingFor(String identifier) { return this.enabled && getCache().getOfferings().contains(identifier); }
private void checkOffering(final String offering) throws NoSuchOfferingException { LOGGER.trace("checkOffering('{}')",offering); LOGGER.trace("Offerings im Cache: {}",Arrays.toString(getCache().getOfferings().toArray())); if (!getCache().getOfferings().contains(offering)) { throw new NoSuchOfferingException(offering); } }
private void checkOffering(final String offering) throws NoSuchOfferingException { LOGGER.trace("checkOffering('{}')",offering); LOGGER.trace("Offerings im Cache: {}",Arrays.toString(getCache().getOfferings().toArray())); if (!getCache().getOfferings().contains(offering)) { throw new NoSuchOfferingException(offering); } }
@ResponseBody @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public String getOfferingExtensions() throws OwsExceptionReport { final Map<String, List<SosObservationOfferingExtension>> offeringExtensions = getCapabilitiesExtensionService().getOfferingExtensions(); final List<String> offerings = Lists.newArrayList(getCache().getOfferings()); Collections.sort(offerings); ObjectNode response = Json.nodeFactory().objectNode(); for (final String offering : offerings) { response.set(offering, toJson(offeringExtensions.get(offering))); } return response.toString(); }
@ResponseBody @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public String getOfferingExtensions() throws OwsExceptionReport { final Map<String, List<SosObservationOfferingExtension>> offeringExtensions = getCapabilitiesExtensionService().getOfferingExtensions(); final List<String> offerings = Lists.newArrayList(getCache().getOfferings()); Collections.sort(offerings); ObjectNode response = Json.nodeFactory().objectNode(); for (final String offering : offerings) { response.set(offering, toJson(offeringExtensions.get(offering))); } return response.toString(); }
private void checkOffering(String offering) throws OwsExceptionReport { if (offering == null || offering.isEmpty()) { throw new MissingOfferingParameterException(); } else if (!getCache().getOfferings().contains(offering)) { throw new InvalidOfferingParameterException(offering); } }
@Override public ListMultiMap<String, SosObservationOfferingExtension> apply(final Session session) { @SuppressWarnings("unchecked") final List<OfferingExtensionImpl> extensions = session.createCriteria(OfferingExtensionImpl.class) .add(eq(OfferingExtensionImpl.ACTIVE, true)).list(); final ListMultiMap<String, SosObservationOfferingExtension> map = new LinkedListMultiMap<>( getCache().getOfferings().size()); for (final OfferingExtensionImpl extension : extensions) { LOGGER.debug("Loaded OfferingExtension: {}", extension); map.add(extension.getOfferingName(), extension); } return map; } }
private void checkOffering(String offering) throws OwsExceptionReport { if (offering == null || offering.isEmpty()) { throw new MissingOfferingParameterException(); } else if (!getCache().getOfferings().contains(offering)) { throw new InvalidOfferingParameterException(offering); } }
@Override public ListMultiMap<String, SosObservationOfferingExtension> apply(final Session session) { @SuppressWarnings("unchecked") final List<OfferingExtensionImpl> extensions = session.createCriteria(OfferingExtensionImpl.class).list(); final ListMultiMap<String, SosObservationOfferingExtension> map = new LinkedListMultiMap<>( getCache().getOfferings().size()); for (final OfferingExtensionImpl extension : extensions) { LOGGER.debug("Loaded OfferingExtension: {}", extension); map.add(extension.getOfferingName(), extension); } return map; } }
@RequestMapping(method = RequestMethod.GET) public ModelAndView view() { Map<String, String> model = new HashMap<>(4); SosContentCache cache = getCache(); model.put(OFFERINGS, asJSONArray(cache.getOfferings())); model.put(PROCEDURES, asJSONArray(cache.getProcedures())); model.put(FEATURES, asJSONArray(cache.getFeaturesOfInterest())); model.put(OBSERVABLE_PROPERTIES, asJSONArray(cache .getObservableProperties())); return new ModelAndView(ControllerConstants.Views.ADMIN_I18N, model); }
@RequestMapping(method = RequestMethod.GET) public ModelAndView view() { Map<String, String> model = new HashMap<>(4); SosContentCache cache = getCache(); model.put(OFFERINGS, asJSONArray(cache.getOfferings())); model.put(PROCEDURES, asJSONArray(cache.getProcedures())); model.put(FEATURES, asJSONArray(cache.getFeaturesOfInterest())); model.put(OBSERVABLE_PROPERTIES, asJSONArray(cache .getObservableProperties())); return new ModelAndView(ControllerConstants.Views.ADMIN_I18N, model); }
protected void checkOffering(String offering, String parameterName, boolean all) throws OwsExceptionReport { if (offering == null || offering.isEmpty()) { throw new MissingParameterValueException(parameterName); } if (all) { if (!getCache().getOfferings().contains(offering)) { throw new InvalidParameterValueException(parameterName, offering); } } else { if (!getCache().getPublishedOfferings().contains(offering)) { throw new InvalidParameterValueException(parameterName, offering); } } }
protected OwsDomain getOfferingParameter(String service, String version) { if (checkListOnlyParentOfferings()) { return getOfferingParameter(service, version, getCache().getParentOfferings(getCache().getOfferings(), false, false)); } else { return getOfferingParameter(service, version, getCache().getOfferings()); } }
public static Map<String, String> getCacheValues() { SosContentCache cache = Configurator.getInstance().getCache(); Map<String, String> values = new TreeMap<>(); values.put(LAST_UPDATE_TIME, nullSafeToString(cache.getLastUpdateTime())); values.put(MIN_PHENOMENON_TIME, nullSafeToString(cache.getMinPhenomenonTime())); values.put(MAX_PHENOMENON_TIME, nullSafeToString(cache.getMaxPhenomenonTime())); values.put(MIN_RESULT_TIME, nullSafeToString(cache.getMinResultTime())); values.put(MAX_RESULT_TIME, nullSafeToString(cache.getMaxResultTime())); values.put(GLOBAL_ENVELOPE, nullSafeToString(cache.getGlobalEnvelope())); values.put(NUM_OFFERINGS, nullSafeToString(cache.getOfferings())); values.put(NUM_PROCEDURES, nullSafeToString(cache.getProcedures())); values.put(NUM_OBSERVABLE_PROPERTIES, nullSafeToString(cache.getObservableProperties())); values.put(NUM_FEATURES_OF_INTEREST, nullSafeToString(cache.getFeaturesOfInterest())); values.put(NUM_FEATURE_OF_INTEREST_TYPES, nullSafeToString(cache.getFeatureOfInterestTypes())); values.put(NUM_OBSERVATION_TYPES, nullSafeToString(cache.getObservationTypes())); values.put(NUM_RELATED_FEATURES, nullSafeToString(cache.getRelatedFeatures())); values.put(NUM_RESULT_TEMPLATES, nullSafeToString(cache.getResultTemplates())); values.put(DEFAULT_EPSG, Integer.toString(cache.getDefaultEPSGCode())); values.put(NUM_EPSGS, nullSafeToString(cache.getEpsgCodes())); return values; }
/** * checks if the passed offeringId is supported * * @param offeringIds * the offeringId to be checked * * * @throws OwsExceptionReport * if the passed offeringId is not supported */ private void checkOfferingId(final List<String> offeringIds) throws OwsExceptionReport { if (offeringIds != null) { final Set<String> offerings = getCache().getOfferings(); final CompositeOwsException exceptions = new CompositeOwsException(); for (final String offeringId : offeringIds) { if (offeringId == null || offeringId.isEmpty()) { exceptions.add(new MissingOfferingParameterException()); } else if (offeringId.contains(SosConstants.SEPARATOR_4_OFFERINGS)) { final String[] offArray = offeringId.split(SosConstants.SEPARATOR_4_OFFERINGS); if (!offerings.contains(offArray[0]) || !getCache().getProceduresForOffering(offArray[0]).contains(offArray[1])) { exceptions.add(new InvalidOfferingParameterException(offeringId)); } } else if (!offerings.contains(offeringId)) { exceptions.add(new InvalidOfferingParameterException(offeringId)); } } exceptions.throwIfNotEmpty(); } }
public static Map<String, String> getCacheValues() { SosContentCache cache = Configurator.getInstance().getCache(); Map<String, String> values = new TreeMap<>(); values.put(LAST_UPDATE_TIME, nullSafeToString(cache.getLastUpdateTime())); values.put(MIN_PHENOMENON_TIME, nullSafeToString(cache.getMinPhenomenonTime())); values.put(MAX_PHENOMENON_TIME, nullSafeToString(cache.getMaxPhenomenonTime())); values.put(MIN_RESULT_TIME, nullSafeToString(cache.getMinResultTime())); values.put(MAX_RESULT_TIME, nullSafeToString(cache.getMaxResultTime())); values.put(GLOBAL_ENVELOPE, nullSafeToString(cache.getGlobalEnvelope())); values.put(NUM_OFFERINGS, nullSafeToString(cache.getOfferings())); values.put(NUM_PROCEDURES, nullSafeToString(cache.getProcedures())); values.put(NUM_OBSERVABLE_PROPERTIES, nullSafeToString(cache.getObservableProperties())); values.put(NUM_FEATURES_OF_INTEREST, nullSafeToString(cache.getFeaturesOfInterest())); values.put(NUM_FEATURE_OF_INTEREST_TYPES, nullSafeToString(cache.getFeatureOfInterestTypes())); values.put(NUM_OBSERVATION_TYPES, nullSafeToString(cache.getObservationTypes())); values.put(NUM_RELATED_FEATURES, nullSafeToString(cache.getRelatedFeatures())); values.put(NUM_RESULT_TEMPLATES, nullSafeToString(cache.getResultTemplates())); values.put(DEFAULT_EPSG, Integer.toString(cache.getDefaultEPSGCode())); values.put(NUM_EPSGS, nullSafeToString(cache.getEpsgCodes())); return values; }
/** * Get the spatial dataset identifiers * * @param version * the service version * @return the spatial dataset identifiers */ private Set<InspireUniqueResourceIdentifier> getSpatialDataSetIdentifier(String version) { Set<InspireUniqueResourceIdentifier> spatialDataSetIdentifier = Sets.newHashSet(); for (String offering : getCache().getOfferings()) { InspireUniqueResourceIdentifier iuri = new InspireUniqueResourceIdentifier(offering); if (getInspireHelper().isSetNamespace()) { iuri.setNamespace(getInspireHelper().getNamespace()); } else { iuri.setNamespace(ServiceConfiguration.getInstance().getServiceURL()); } spatialDataSetIdentifier.add(iuri); } return spatialDataSetIdentifier; }
/** * Get the spatial dataset identifiers * * @param version * the service version * @return the spatial dataset identifiers */ private Set<InspireUniqueResourceIdentifier> getSpatialDataSetIdentifier(String version) { Set<InspireUniqueResourceIdentifier> spatialDataSetIdentifier = Sets.newHashSet(); for (String offering : getCache().getOfferings()) { InspireUniqueResourceIdentifier iuri = new InspireUniqueResourceIdentifier(offering); if (getInspireHelper().isSetNamespace()) { iuri.setNamespace(getInspireHelper().getNamespace()); } else { iuri.setNamespace(ServiceConfiguration.getInstance().getServiceURL()); } spatialDataSetIdentifier.add(iuri); } return spatialDataSetIdentifier; }
private void checkAndAddOfferingToObservationConstallation(final InsertObservationRequest request) throws OwsExceptionReport { // TODO: Check requirement for this case in SOS 2.0 specification if (request.getOfferings() == null || (request.getOfferings() != null && request.getOfferings().isEmpty())) { throw new MissingOfferingParameterException(); } else { final CompositeOwsException exceptions = new CompositeOwsException(); for (final String offering : request.getOfferings()) { if (offering == null || offering.isEmpty()) { exceptions.add(new MissingOfferingParameterException()); } else if (!getCache().getOfferings().contains(offering)) { exceptions.add(new InvalidOfferingParameterException(offering)); } else { request.getObservations().forEach(observation -> observation.getObservationConstellation().addOffering(offering)); } } exceptions.throwIfNotEmpty(); } }