use of org.n52.shetland.ogc.swe.SweDataStream in project arctic-sea by 52North.
the class SensorMLDecoderV20 method parseDataInterfaceType.
protected SmlDataInterface parseDataInterfaceType(DataInterfaceType xbDataInterface) throws DecodingException {
SmlDataInterface dataInterface = new SmlDataInterface();
// TODO implement- no funding at the moment available
// When starting implementation: Do not forget to activate the already
// available unit tests
Object data = decodeXmlElement(xbDataInterface.getData());
if (data instanceof SweDataStream) {
dataInterface.setData((SweDataStream) data);
}
if (xbDataInterface.isSetInterfaceParameters()) {
Object parameter = decodeXmlElement(xbDataInterface.getInterfaceParameters());
if (parameter instanceof SweDataRecord) {
dataInterface.setInputParameters((SweDataRecord) parameter);
}
// TODO throw exception if not instance of SweDataRecord
}
return dataInterface;
}
use of org.n52.shetland.ogc.swe.SweDataStream in project arctic-sea by 52North.
the class SweCommonDecoderV20 method parseDataStream.
private SweDataStream parseDataStream(DataStreamType dataStream) throws DecodingException {
SweDataStream sweDataStream = new SweDataStream();
if (dataStream.isSetElementCount() && dataStream.getElementCount().getCount() != null) {
sweDataStream.setElementCount(parseCount(dataStream.getElementCount().getCount()));
}
// parse data record to elementType
ElementType xbElementType = dataStream.getElementType();
if (xbElementType != null && xbElementType.getAbstractDataComponent() != null) {
sweDataStream.setElementType(parseAbstractDataComponent(xbElementType.getAbstractDataComponent()));
}
if (dataStream.getEncoding() != null && dataStream.getEncoding().getAbstractEncoding() != null) {
sweDataStream.setEncoding(parseEncoding(dataStream.getEncoding().getAbstractEncoding()));
}
// parse values
if (dataStream.getValues() != null) {
sweDataStream.setValues(parseValues(sweDataStream.getElementCount(), sweDataStream.getElementType(), sweDataStream.getEncoding(), dataStream.getValues()));
}
// set XML
DataStreamDocument dataStreamDoc = DataStreamDocument.Factory.newInstance(getXmlOptions());
dataStreamDoc.setDataStream(dataStream);
sweDataStream.setXml(dataStreamDoc.xmlText(getXmlOptions()));
return sweDataStream;
}
Aggregations