Search in sources :

Example 6 with DataRecord

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

the class SweHelper method createElementType.

private SweAbstractDataComponent createElementType(SingleObservationValue<?> sov, String name) throws EncodingException {
    SweDataRecord dataRecord = new SweDataRecord();
    dataRecord.addField(getPhenomenonTimeField(sov.getPhenomenonTime()));
    dataRecord.addField(getFieldForValue(sov.getValue(), name));
    return dataRecord;
}
Also used : SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord)

Example 7 with DataRecord

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

the class SweDataRecordTest method getFieldIndexByIdentifier_should_return_one.

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

Example 8 with DataRecord

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

the class ProfileLevel method valueAsDataRecord.

public SweDataRecord valueAsDataRecord(SweDataRecord dataRecord) {
    int counter = 0;
    for (Value<?> v : getValue()) {
        if (v instanceof SweAbstractDataComponent) {
            SweAbstractDataComponent adc = (SweAbstractDataComponent) v;
            String name;
            if (adc.isSetName()) {
                name = adc.getName().getValue();
            } else if (adc.isSetDefinition()) {
                name = adc.getDefinition();
            } else {
                name = "component_" + counter++;
            }
            dataRecord.addField(new SweField(name, adc));
        }
    }
    return dataRecord;
}
Also used : SweField(org.n52.shetland.ogc.swe.SweField) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent)

Example 9 with DataRecord

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

the class ProfileValue method asDataRecord.

public SweDataRecord asDataRecord() {
    SweDataRecord dataRecord = new SweDataRecord();
    if (isSetIdentifier()) {
        dataRecord.setIdentifier(getIdentifier());
    }
    if (isSetName()) {
        dataRecord.setName(getName());
    }
    if (isSetDescription()) {
        dataRecord.setDescription(getDescription());
    }
    int counter = 0;
    for (ProfileLevel level : getValue()) {
        dataRecord.addField(new SweField("level_" + counter++, level.asDataRecord()));
    }
    return dataRecord;
}
Also used : SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) SweField(org.n52.shetland.ogc.swe.SweField)

Example 10 with DataRecord

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

the class AbstractSmlDataComponentContainer method getDataRecord.

/**
 * @return the dataRecord
 */
public DataRecord getDataRecord() {
    if (!isSetDataRecord() && isSetDataComponents()) {
        SweSimpleDataRecord sdr = new SweSimpleDataRecord();
        int counter = 1;
        for (SweAbstractDataComponent element : abstractDataComponents) {
            String n = "field_" + counter++;
            if (element.isSetName()) {
                n = element.getName().getValue();
            }
            SweField field = new SweField(n, element);
            sdr.addField(field);
        }
        return sdr;
    }
    return dataRecord;
}
Also used : SweSimpleDataRecord(org.n52.shetland.ogc.swe.SweSimpleDataRecord) SweField(org.n52.shetland.ogc.swe.SweField) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent)

Aggregations

SweField (org.n52.shetland.ogc.swe.SweField)5 Test (org.junit.Test)4 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)4 XmlObject (org.apache.xmlbeans.XmlObject)2 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)2 SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)2 Capabilities (net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities)1 InputList (net.opengis.sensorML.x101.InputsDocument.Inputs.InputList)1 IoComponentPropertyType (net.opengis.sensorML.x101.IoComponentPropertyType)1 OutputList (net.opengis.sensorML.x101.OutputsDocument.Outputs.OutputList)1 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)1 SystemType (net.opengis.sensorML.x101.SystemType)1 DataArrayType (net.opengis.swe.x101.DataArrayType)1 DataRecordType (net.opengis.swe.x101.DataRecordType)1 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)1 AbstractPhenomenon (org.n52.shetland.ogc.om.AbstractPhenomenon)1 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)1 OmObservation (org.n52.shetland.ogc.om.OmObservation)1 ComplexValue (org.n52.shetland.ogc.om.values.ComplexValue)1 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)1