use of org.n52.shetland.ogc.ows.OwsRange in project arctic-sea by 52North.
the class GetCapabilitiesResponseEncoder method encodeOwsRange.
private JsonNode encodeOwsRange(OwsValueRestriction restriction) {
OwsRange range = restriction.asRange();
ObjectNode json = nodeFactory().objectNode();
encodeOptional(json, JSONConstants.MIN, range.getLowerBound(), this::encodeOwsValue);
encodeOptional(json, JSONConstants.MAX, range.getUpperBound(), this::encodeOwsValue);
json.set(JSONConstants.TYPE, nodeFactory().textNode(range.getType()));
encodeOptional(json, JSONConstants.SPACING, range.getSpacing(), this::encodeOwsValue);
return json;
}
use of org.n52.shetland.ogc.ows.OwsRange 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.OwsRange in project arctic-sea by 52North.
the class AbstractCapabilitiesBaseTypeDecoder method parseRange.
private OwsRange parseRange(RangeType range) {
if (range == null) {
return null;
}
OwsValue upperBound = parseValue(range.getMaximumValue());
OwsValue lowerBound = parseValue(range.getMinimumValue());
OwsValue spacing = parseValue(range.getSpacing());
String type = null;
if (range.isSetRangeClosure() && !range.getRangeClosure().isEmpty()) {
type = (String) range.getRangeClosure().get(0);
}
return new OwsRange(lowerBound, upperBound, type, spacing);
}
Aggregations