use of org.n52.shetland.ogc.ows.OwsPossibleValues in project arctic-sea by 52North.
the class AbstractGetCapabilitiesHandler method getAcceptLanguagesDomain.
private OwsDomain getAcceptLanguagesDomain() {
Set<Locale> availableLocales = serviceMetadataRepository.getAvailableLocales();
OwsPossibleValues possibleValues = new OwsAllowedValues(availableLocales.stream().map(LocaleHelper::encode).map(OwsValue::new));
return new OwsDomain(GetCapabilitiesParams.AcceptLanguages, possibleValues);
}
use of org.n52.shetland.ogc.ows.OwsPossibleValues in project arctic-sea by 52North.
the class AbstractGetCapabilitiesHandler method getSectionsDomain.
private OwsDomain getSectionsDomain() {
OwsPossibleValues possibleValues = new OwsAllowedValues(Arrays.stream(OWSConstants.CapabilitiesSection.values()).map(Object::toString).map(OwsValue::new));
OwsValue defaultValue = new OwsValue(OWSConstants.CapabilitiesSection.All.toString());
return new OwsDomain(GetCapabilitiesParams.Sections, possibleValues, defaultValue);
}
use of org.n52.shetland.ogc.ows.OwsPossibleValues in project arctic-sea by 52North.
the class AbstractCapabilitiesBaseTypeDecoder method parseDomain.
private OwsDomain parseDomain(DomainType domain) {
if (domain == null) {
return null;
}
OwsValue defaultValue = parseValue(domain.getDefaultValue());
Collection<OwsMetadata> metadata = parseMetadata(domain.getMetadataArray());
OwsDomainMetadata meaning = parseDomainMetadata(domain.getMeaning());
OwsDomainMetadata dataType = parseDomainMetadata(domain.getDataType());
OwsValuesUnit valuesUnit = Stream.of(parseUom(domain.getUOM()), parseReferenceSystem(domain.getReferenceSystem())).filter(Objects::nonNull).findFirst().orElse(null);
OwsPossibleValues possibleValues = Stream.of(parseAnyValue(domain.getAnyValue()), parseAllowedValues(domain.getAllowedValues()), parseValuesReference(domain.getValuesReference()), parseNoValues(domain.getNoValues())).filter(Objects::nonNull).findFirst().orElse(null);
return new OwsDomain(domain.getName(), possibleValues, defaultValue, meaning, dataType, valuesUnit, metadata);
}
use of org.n52.shetland.ogc.ows.OwsPossibleValues in project arctic-sea by 52North.
the class OwsEncoderv110 method encodeOwsPossibleValues.
private void encodeOwsPossibleValues(OwsPossibleValues possibleValues, DomainType xdomain) {
if (possibleValues.isAnyValue()) {
xdomain.addNewAnyValue();
} else if (possibleValues.isNoValues()) {
xdomain.addNewNoValues();
} else if (possibleValues.isValuesReference()) {
OwsValuesReference vr = possibleValues.asValuesReference();
ValuesReference xvr = xdomain.addNewValuesReference();
xvr.setReference(vr.getReference().toString());
xvr.setStringValue(vr.getValue());
} else if (possibleValues.isAllowedValues()) {
OwsAllowedValues av = possibleValues.asAllowedValues();
AllowedValues xav = xdomain.addNewAllowedValues();
av.getRestrictions().forEach(restriction -> {
if (restriction.isRange()) {
OwsRange range = restriction.asRange();
RangeType xrange = xav.addNewRange();
range.getLowerBound().map(OwsValue::getValue).ifPresent(v -> xrange.addNewMinimumValue().setStringValue(v));
range.getUpperBound().map(OwsValue::getValue).ifPresent(v -> xrange.addNewMaximumValue().setStringValue(v));
range.getSpacing().map(OwsValue::getValue).ifPresent(v -> xrange.addNewSpacing().setStringValue(v));
xrange.setRangeClosure(Collections.singletonList(range.getType()));
} else if (restriction.isValue()) {
xav.addNewValue().setStringValue(restriction.asValue().getValue());
}
});
}
}
use of org.n52.shetland.ogc.ows.OwsPossibleValues in project arctic-sea by 52North.
the class AbstractGetCapabilitiesHandler method getAcceptVersionsDomain.
private OwsDomain getAcceptVersionsDomain(String service) {
Set<String> supportedVersions = this.serviceOperatorRepository.getSupportedVersions(service);
OwsValue defaultValue = new OwsValue(Comparables.version().max(supportedVersions));
OwsPossibleValues possibleValues = new OwsAllowedValues(supportedVersions.stream().map(OwsValue::new));
return new OwsDomain(GetCapabilitiesParams.AcceptVersions, possibleValues, defaultValue);
}
Aggregations