Search in sources :

Example 6 with TextValue

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());
}
Also used : SweTimeRange(org.n52.shetland.ogc.swe.simpleType.SweTimeRange) DateTime(org.joda.time.DateTime)

Example 7 with 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);
    }
}
Also used : GeoJSONDecodingException(org.n52.svalbard.coding.json.GeoJSONDecodingException) JsonNode(com.fasterxml.jackson.databind.JsonNode) MultiLineString(org.locationtech.jts.geom.MultiLineString) LineString(org.locationtech.jts.geom.LineString)

Example 8 with TextValue

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;
    }
}
Also used : CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority)

Example 9 with TextValue

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"));
}
Also used : ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) Test(org.junit.Test)

Example 10 with TextValue

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"));
}
Also used : ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) Test(org.junit.Test)

Aggregations

TextValue (org.n52.shetland.ogc.om.values.TextValue)9 Test (org.junit.Test)8 CategoryValue (org.n52.shetland.ogc.om.values.CategoryValue)6 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)6 ComparisonFilter (org.n52.shetland.ogc.filter.ComparisonFilter)5 BooleanValue (org.n52.shetland.ogc.om.values.BooleanValue)5 CountValue (org.n52.shetland.ogc.om.values.CountValue)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 GeometryValue (org.n52.shetland.ogc.om.values.GeometryValue)4 SweCount (org.n52.shetland.ogc.swe.simpleType.SweCount)4 XmlBoolean (org.apache.xmlbeans.XmlBoolean)3 XmlInteger (org.apache.xmlbeans.XmlInteger)3 XmlObject (org.apache.xmlbeans.XmlObject)3 XmlString (org.apache.xmlbeans.XmlString)3 SweField (org.n52.shetland.ogc.swe.SweField)3 BigDecimal (java.math.BigDecimal)2 XmlException (org.apache.xmlbeans.XmlException)2 DateTime (org.joda.time.DateTime)2 Geometry (org.locationtech.jts.geom.Geometry)2 BinaryLogicFilter (org.n52.shetland.ogc.filter.BinaryLogicFilter)2