Search in sources :

Example 31 with TextValue

use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.

the class InsertResultTemplateRequestDecoder method decodeRequest.

@Override
public InsertResultTemplateRequest decodeRequest(JsonNode node) throws DecodingException {
    InsertResultTemplateRequest irtr = new InsertResultTemplateRequest();
    if (!node.path(JSONConstants.IDENTIFIER).isMissingNode()) {
        irtr.setIdentifier(node.path(JSONConstants.IDENTIFIER).textValue());
    }
    irtr.setObservationTemplate(parseObservationTemplate(node));
    irtr.setResultStructure(parseResultStructure(node.path(JSONConstants.RESULT_STRUCTURE)));
    irtr.setResultEncoding(parseResultEncoding(node.path(JSONConstants.RESULT_ENCODING)));
    return irtr;
}
Also used : InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest)

Example 32 with TextValue

use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.

the class AbstractJSONDecoder method parseReference.

protected Reference parseReference(JsonNode node) {
    Reference ref = new Reference();
    ref.setHref(URI.create(node.path(AQDJSONConstants.HREF).textValue()));
    ref.setActuate(node.path(AQDJSONConstants.ACTUATE).textValue());
    ref.setArcrole(node.path(AQDJSONConstants.ARCROLE).textValue());
    ref.setRemoteSchema(node.path(AQDJSONConstants.REMOTE_SCHEMA).textValue());
    ref.setRole(node.path(AQDJSONConstants.ROLE).textValue());
    ref.setShow(node.path(AQDJSONConstants.SHOW).textValue());
    ref.setTitle(node.path(AQDJSONConstants.TITLE).textValue());
    ref.setType(node.path(AQDJSONConstants.TYPE).textValue());
    return ref;
}
Also used : Reference(org.n52.shetland.w3c.xlink.Reference)

Example 33 with TextValue

use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.

the class JSONDecoder method parseTimePeriod.

protected TimePeriod parseTimePeriod(JsonNode node) throws DateTimeParseException {
    if (node.isArray()) {
        ArrayNode array = (ArrayNode) node;
        String startTime = array.get(0).textValue();
        String endTime = array.get(1).textValue();
        DateTime start = parseDateTime(startTime);
        DateTime end = parseDateTime(endTime);
        return new TimePeriod(start, end);
    } else {
        return null;
    }
}
Also used : TimePeriod(org.n52.shetland.ogc.gml.time.TimePeriod) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) DateTime(org.joda.time.DateTime)

Example 34 with TextValue

use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.

the class TextObservationDecodingTest method testObservation.

@Test
public void testObservation() {
    assertThat(observation, is(notNullValue()));
    final String type = observation.getObservationConstellation().getObservationType();
    assertThat(type, is(equalTo(OmConstants.OBS_TYPE_TEXT_OBSERVATION)));
    final ObservationValue<?> value = observation.getValue();
    assertThat(value, is(instanceOf(SingleObservationValue.class)));
    assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
    TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
    assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
    assertThat(value.getValue(), is(instanceOf(TextValue.class)));
    TextValue v = (TextValue) value.getValue();
    assertThat(v.getValue(), is(equalTo("Some Value")));
    assertThat(v.getUnit(), is(nullValue()));
}
Also used : TextValue(org.n52.shetland.ogc.om.values.TextValue) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Test(org.junit.Test)

Example 35 with TextValue

use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.

the class ODataFesParserTest method testContains.

@Test
public void testContains() throws DecodingException {
    Filter<?> filter = parser.decode("contains(textValue,'as%df')");
    assertThat(filter, is(instanceOf(ComparisonFilter.class)));
    ComparisonFilter cf = (ComparisonFilter) filter;
    errors.checkThat(cf.getOperator(), is(ComparisonOperator.PropertyIsLike));
    errors.checkThat(cf.getValue(), is("%as%df%"));
    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