Search in sources :

Example 1 with SweBoolean

use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.

the class HasExtension method addSweBooleanExtension.

default void addSweBooleanExtension(String name, boolean value) {
    SweBoolean sweBoolean = new SweBoolean();
    sweBoolean.setValue(value);
    sweBoolean.setIdentifier(name);
    addSwesExtension(name, sweBoolean);
}
Also used : SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean)

Example 2 with SweBoolean

use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.

the class SmlIoTest method should_return_true_if_ioValue_is_set.

@Test
public void should_return_true_if_ioValue_is_set() {
    final SweBoolean ioValue = new SweBoolean();
    final SmlIo smlIo = new SmlIo(ioValue);
    assertThat(smlIo.isSetValue(), is(TRUE));
}
Also used : SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) Test(org.junit.Test)

Example 3 with SweBoolean

use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.

the class SweDataRecordTest method getFieldIndexByIdentifier_should_not_fail_on_bad_input.

@Test
public void getFieldIndexByIdentifier_should_not_fail_on_bad_input() {
    final SweDataRecord dataRecord = new SweDataRecord();
    dataRecord.addField(new SweField("identifier", new SweBoolean()));
    final SweBoolean b = new SweBoolean();
    b.setDefinition("test-element-definition");
    dataRecord.addField(new SweField("test-field-name", b));
    assertThat(dataRecord.getFieldIndexByIdentifier(null), is(-1));
    assertThat(dataRecord.getFieldIndexByIdentifier(""), is(-1));
}
Also used : SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) Test(org.junit.Test)

Example 4 with SweBoolean

use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.

the class FieldDecoderTest method testBooleanWithValueTrue.

@Test
public void testBooleanWithValueTrue() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.BOOLEAN_TYPE).put(JSONConstants.VALUE, true);
    SweField field = checkCommon(json, true);
    assertThat(field.getElement(), is(instanceOf(SweBoolean.class)));
    SweBoolean swe = (SweBoolean) field.getElement();
    errors.checkThat(swe.getValue(), is(true));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) Test(org.junit.Test)

Example 5 with SweBoolean

use of org.n52.shetland.ogc.swe.simpleType.SweBoolean in project arctic-sea by 52North.

the class FieldEncoder method encodeSweBooleanField.

private ObjectNode encodeSweBooleanField(SweField field) {
    ObjectNode jfield = createField(field);
    jfield.put(JSONConstants.TYPE, JSONConstants.BOOLEAN_TYPE);
    SweBoolean sweBoolean = (SweBoolean) field.getElement();
    if (sweBoolean.isSetValue()) {
        jfield.put(JSONConstants.VALUE, sweBoolean.getValue());
    }
    return jfield;
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean)

Aggregations

SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)22 Test (org.junit.Test)13 XmlObject (org.apache.xmlbeans.XmlObject)10 SweText (org.n52.shetland.ogc.swe.simpleType.SweText)8 SweField (org.n52.shetland.ogc.swe.SweField)7 SweCategory (org.n52.shetland.ogc.swe.simpleType.SweCategory)7 SweCount (org.n52.shetland.ogc.swe.simpleType.SweCount)7 SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)7 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)5 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)5 NotYetSupportedEncodingException (org.n52.svalbard.encode.exception.NotYetSupportedEncodingException)5 EncodingException (org.n52.svalbard.encode.exception.EncodingException)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 AnyScalarPropertyType (net.opengis.swe.x101.AnyScalarPropertyType)3 DataComponentPropertyType (net.opengis.swe.x101.DataComponentPropertyType)3 DataRecordType (net.opengis.swe.x101.DataRecordType)3 BooleanType (net.opengis.swe.x20.BooleanType)3 SweTime (org.n52.shetland.ogc.swe.simpleType.SweTime)3 SweTimeRange (org.n52.shetland.ogc.swe.simpleType.SweTimeRange)3 BigDecimal (java.math.BigDecimal)2