Search in sources :

Example 11 with TextValue

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

the class ODataFesParserTest method testDisjunction.

@Test
@SuppressWarnings("unchecked")
public void testDisjunction() throws Exception {
    Filter<?> filter = parser.decode("countValue lt 10 or textValue eq 'thetext'");
    assertThat(filter, is(instanceOf(BinaryLogicFilter.class)));
    BinaryLogicFilter blf = (BinaryLogicFilter) filter;
    errors.checkThat(blf.getOperator(), is(BinaryLogicOperator.Or));
    Set<Filter<?>> filterPredicates = blf.getFilterPredicates();
    errors.checkThat(filterPredicates, Matchers.containsInAnyOrder(Matchers.instanceOf(ComparisonFilter.class), Matchers.instanceOf(ComparisonFilter.class)));
}
Also used : SpatialFilter(org.n52.shetland.ogc.filter.SpatialFilter) BinaryLogicFilter(org.n52.shetland.ogc.filter.BinaryLogicFilter) ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) Filter(org.n52.shetland.ogc.filter.Filter) BinaryLogicFilter(org.n52.shetland.ogc.filter.BinaryLogicFilter) Test(org.junit.Test)

Example 12 with TextValue

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

the class ObservationEncoder method getFieldForValue.

private SweField getFieldForValue(String phenomenon, Value<?> value) throws EncodingException {
    final SweAbstractDataComponent def;
    if (value instanceof BooleanValue) {
        def = new SweBoolean();
    } else if (value instanceof CategoryValue) {
        SweCategory sweCategory = new SweCategory();
        CategoryValue categoryValue = (CategoryValue) value;
        sweCategory.setCodeSpace(categoryValue.getUnit());
        def = sweCategory;
    } else if (value instanceof CountValue) {
        def = new SweCount();
    } else if (value instanceof QuantityValue) {
        SweQuantity sweQuantity = new SweQuantity();
        QuantityValue quantityValue = (QuantityValue) value;
        sweQuantity.setUom(quantityValue.getUnit());
        def = sweQuantity;
    } else if (value instanceof TextValue) {
        def = new SweText();
    } else if (value instanceof NilTemplateValue) {
        def = new SweText();
    } else if (value instanceof BooleanValue) {
        def = new SweBoolean();
    } else if (value instanceof GeometryValue) {
        def = new SweText();
    } else {
        throw new UnsupportedEncoderInputException(this, value);
    }
    def.setDefinition(phenomenon);
    return new SweField(phenomenon, def);
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) SweText(org.n52.shetland.ogc.swe.simpleType.SweText) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException) GeometryValue(org.n52.shetland.ogc.om.values.GeometryValue) CountValue(org.n52.shetland.ogc.om.values.CountValue) SweField(org.n52.shetland.ogc.swe.SweField) QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) TextValue(org.n52.shetland.ogc.om.values.TextValue) BooleanValue(org.n52.shetland.ogc.om.values.BooleanValue) CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) NilTemplateValue(org.n52.shetland.ogc.om.values.NilTemplateValue)

Example 13 with TextValue

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

the class InsertSensorRequestDecoder method decodeRequest.

@Override
protected InsertSensorRequest decodeRequest(JsonNode node) throws DecodingException {
    final InsertSensorRequest r = new InsertSensorRequest();
    final SosInsertionMetadata meta = new SosInsertionMetadata();
    meta.setFeatureOfInterestTypes(parseStringOrStringList(node.path(JSONConstants.FEATURE_OF_INTEREST_TYPE)));
    meta.setObservationTypes(parseStringOrStringList(node.path(JSONConstants.OBSERVATION_TYPE)));
    r.setMetadata(meta);
    r.setObservableProperty(parseStringOrStringList(node.path(JSONConstants.OBSERVABLE_PROPERTY)));
    r.setProcedureDescriptionFormat(node.path(JSONConstants.PROCEDURE_DESCRIPTION_FORMAT).textValue());
    r.setRelatedFeature(parseFeatureRelationships(node.path(JSONConstants.RELATED_FEATURE)));
    r.setProcedureDescription(parseProcedureDescription(node.path(JSONConstants.PROCEDURE_DESCRIPTION), r.getProcedureDescriptionFormat()));
    return r;
}
Also used : SosInsertionMetadata(org.n52.shetland.ogc.sos.SosInsertionMetadata) InsertSensorRequest(org.n52.shetland.ogc.sos.request.InsertSensorRequest)

Example 14 with TextValue

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

the class GetCapabilitiesRequestDecoder method decodeRequest.

@Override
protected GetCapabilitiesRequest decodeRequest(JsonNode node) {
    GetCapabilitiesRequest req = new GetCapabilitiesRequest(SosConstants.SOS);
    req.setAcceptFormats(parseStringOrStringList(node.path(JSONConstants.ACCEPT_FORMATS)));
    req.setAcceptVersions(parseStringOrStringList(node.path(JSONConstants.ACCEPT_VERSIONS)));
    req.setSections(parseStringOrStringList(node.path(JSONConstants.SECTIONS)));
    req.setUpdateSequence(node.path(JSONConstants.UPDATE_SEQUENCE).textValue());
    return req;
}
Also used : GetCapabilitiesRequest(org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest)

Example 15 with TextValue

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

the class GetObservationRequestDecoder method decodeRequest.

@Override
public GetObservationRequest decodeRequest(JsonNode node) throws DecodingException {
    GetObservationRequest r = new GetObservationRequest();
    r.setFeatureIdentifiers(parseStringOrStringList(node.path(JSONConstants.FEATURE_OF_INTEREST)));
    r.setObservedProperties(parseStringOrStringList(node.path(JSONConstants.OBSERVED_PROPERTY)));
    r.setOfferings(parseStringOrStringList(node.path(JSONConstants.OFFERING)));
    r.setProcedures(parseStringOrStringList(node.path(JSONConstants.PROCEDURE)));
    r.setResponseFormat(node.path(JSONConstants.RESPONSE_FORMAT).textValue());
    r.setResponseMode(node.path(JSONConstants.RESPONSE_MODE).textValue());
    r.setResultModel(node.path(JSONConstants.RESULT_MODEL).textValue());
    r.setResultFilter(parseComparisonFilter(node.path(JSONConstants.RESULT_FILTER)));
    r.setSpatialFilter(parseSpatialFilter(node.path(JSONConstants.SPATIAL_FILTER)));
    r.setTemporalFilters(parseTemporalFilters(node.path(JSONConstants.TEMPORAL_FILTER)));
    // TODO whats that for?
    r.setRequestString(Json.print(node));
    return r;
}
Also used : GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest)

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