Search in sources :

Example 21 with TextValue

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

the class SweCommonEncoderv20Test method shouldEncodeDataRecordWithSweTextField.

@Test
public void shouldEncodeDataRecordWithSweTextField() throws OwsExceptionReport, EncodingException {
    final SweDataRecord record = new SweDataRecord();
    record.addField(new SweField("text", new SweText().setValue("textValue").setDefinition("textDef")));
    record.addField(new SweField("count", new SweCount().setValue(2).setDefinition("countDef")));
    final XmlObject encoded = sweCommonEncoderv20.encode(record);
    // validateDocument throws exceptions if the document is invalid
    XmlHelper.validateDocument(encoded, EncodingException::new);
}
Also used : SweText(org.n52.shetland.ogc.swe.simpleType.SweText) SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) SweField(org.n52.shetland.ogc.swe.SweField) EncodingException(org.n52.svalbard.encode.exception.EncodingException) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) XmlObject(org.apache.xmlbeans.XmlObject) Test(org.junit.Test)

Example 22 with TextValue

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

the class SweCommonDecoderV101Test method should_decode_Count_with_Quality_Text.

@Test
public void should_decode_Count_with_Quality_Text() throws DecodingException {
    final CountDocument xbCount = CountDocument.Factory.newInstance();
    final String textValue = "quality-text";
    xbCount.addNewCount().addNewQuality().addNewText().setValue(textValue);
    final Object decodedObject = new SweCommonDecoderV101().decode(xbCount);
    assertThat(decodedObject, is(instanceOf(SweCount.class)));
    final SweCount sweCount = (SweCount) decodedObject;
    assertThat(sweCount.isSetQuality(), is(true));
    assertThat(sweCount.getQuality().size(), is(1));
    assertThat(sweCount.getQuality().iterator().next(), is(instanceOf(SweText.class)));
    assertThat(((SweText) sweCount.getQuality().iterator().next()).getValue(), is(textValue));
}
Also used : CountDocument(net.opengis.swe.x101.CountDocument) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) Test(org.junit.Test)

Example 23 with TextValue

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

the class WmlObservationProcessDecoderv20Test method getTextNamedValue.

private NamedValue<String> getTextNamedValue() {
    NamedValue<String> nv = new NamedValue<String>();
    nv.setName(getNameValueOfferingName());
    nv.setValue(new TextValue(TEXT_OFFERING));
    return nv;
}
Also used : TextValue(org.n52.shetland.ogc.om.values.TextValue) NamedValue(org.n52.shetland.ogc.om.NamedValue)

Example 24 with TextValue

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

the class GWGeologyLogCoveragePropertyEncoderTest method createProfileLevel.

private List<Value<?>> createProfileLevel() {
    List<Value<?>> list = Lists.newArrayList();
    CategoryValue category = new CategoryValue("weathered grey brown basalt", "unknown");
    category.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
    category.addName(new CodeType("lithology"));
    list.add(category);
    TextValue text = new TextValue("weathered grey brown basalt");
    text.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
    text.addName(new CodeType("text"));
    list.add(text);
    return list;
}
Also used : TextValue(org.n52.shetland.ogc.om.values.TextValue) ProfileValue(org.n52.shetland.ogc.om.values.ProfileValue) QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) TextValue(org.n52.shetland.ogc.om.values.TextValue) CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) Value(org.n52.shetland.ogc.om.values.Value) CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) CodeType(org.n52.shetland.ogc.gml.CodeType)

Example 25 with TextValue

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

the class BatchRequestDecoder method getDecoder.

private Decoder<OwsServiceRequest, JsonNode> getDecoder(JsonNode n) throws DecodingException {
    String service = n.path(JSONConstants.SERVICE).textValue();
    String version = n.path(JSONConstants.VERSION).textValue();
    String request = n.path(JSONConstants.REQUEST).textValue();
    OperationDecoderKey k = new OperationDecoderKey(service, version, request, MediaTypes.APPLICATION_JSON);
    Decoder<OwsServiceRequest, JsonNode> decoder = getDecoder(k);
    if (decoder == null) {
        // TODO other exception?
        throw new NoDecoderForKeyException(k);
    }
    return decoder;
}
Also used : NoDecoderForKeyException(org.n52.svalbard.decode.exception.NoDecoderForKeyException) JsonNode(com.fasterxml.jackson.databind.JsonNode) OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey)

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