use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class FieldDecoder method decodeTimeRange.
protected SweAbstractDataComponent decodeTimeRange(JsonNode node) throws DecodingException {
SweTimeRange swe = new SweTimeRange();
if (node.hasNonNull(JSONConstants.VALUE)) {
String start = node.path(JSONConstants.VALUE).path(0).textValue();
String end = node.path(JSONConstants.VALUE).path(1).textValue();
swe.setValue(new RangeValue<DateTime>(parseDateTime(start), parseDateTime(end)));
}
return swe.setUom(node.path(JSONConstants.UOM).textValue());
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class GeoJSONDecoder method decodeCRS.
protected GeometryFactory decodeCRS(JsonNode node, GeometryFactory factory) throws GeoJSONDecodingException {
if (!node.path(JSONConstants.CRS).hasNonNull(JSONConstants.TYPE)) {
throw new GeoJSONDecodingException("Missing CRS type");
}
String type = node.path(JSONConstants.CRS).path(JSONConstants.TYPE).textValue();
JsonNode properties = node.path(JSONConstants.CRS).path(JSONConstants.PROPERTIES);
switch(type) {
case JSONConstants.NAME:
return decodeNamedCRS(properties, factory);
case JSONConstants.LINK:
return decodeLinkedCRS(properties, factory);
default:
throw new GeoJSONDecodingException("Unknown CRS type: " + type);
}
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class JSONDecoder method parseCodeWithAuthority.
protected CodeWithAuthority parseCodeWithAuthority(JsonNode node) {
if (node.isObject()) {
String value = node.path(JSONConstants.VALUE).textValue();
String codespace = node.path(JSONConstants.CODESPACE).textValue();
if (codespace == null || codespace.isEmpty()) {
codespace = OGCConstants.UNKNOWN;
}
return new CodeWithAuthority(value, codespace);
} else if (node.isTextual()) {
return new CodeWithAuthority(node.textValue(), OGCConstants.UNKNOWN);
} else {
return null;
}
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class ODataFesParserTest method testEndswith.
@Test
public void testEndswith() throws DecodingException {
Filter<?> filter = parser.decode("endswith(textValue,'asdf')");
assertThat(filter, is(instanceOf(ComparisonFilter.class)));
ComparisonFilter cf = (ComparisonFilter) filter;
errors.checkThat(cf.getOperator(), is(ComparisonOperator.PropertyIsLike));
errors.checkThat(cf.getValue(), is("%asdf"));
errors.checkThat(cf.getValueReference(), is("om:result"));
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class ODataFesParserTest method testStartswith.
@Test
public void testStartswith() throws DecodingException {
Filter<?> filter = parser.decode("startswith(textValue,'asdf')");
assertThat(filter, is(instanceOf(ComparisonFilter.class)));
ComparisonFilter cf = (ComparisonFilter) filter;
errors.checkThat(cf.getOperator(), is(ComparisonOperator.PropertyIsLike));
errors.checkThat(cf.getValue(), is("asdf%"));
errors.checkThat(cf.getValueReference(), is("om:result"));
}
Aggregations