use of net.opengis.swe.x20.DataArrayType.Encoding in project arctic-sea by 52North.
the class GetResultTemplateResponseEncoder method createResultStructure.
private ResultStructure createResultStructure(SosResultStructure resultStructure) throws EncodingException {
// TODO move encoding to SWECommonEncoder
final DataRecordDocument dataRecordDoc;
if (resultStructure.isEncoded()) {
try {
dataRecordDoc = DataRecordDocument.Factory.parse(resultStructure.getXml().get());
} catch (XmlException ex) {
throw unsupportedResultStructure(ex);
}
} else {
XmlObject xml = encodeSwe(EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT), resultStructure.get().get());
if (xml instanceof DataRecordDocument) {
dataRecordDoc = (DataRecordDocument) xml;
} else {
throw unsupportedResultStructure();
}
}
ResultStructure xbResultStructure = ResultStructure.Factory.newInstance(getXmlOptions());
xbResultStructure.addNewAbstractDataComponent().set(dataRecordDoc.getDataRecord());
XmlHelper.substituteElement(xbResultStructure.getAbstractDataComponent(), dataRecordDoc.getDataRecord());
return xbResultStructure;
}
use of net.opengis.swe.x20.DataArrayType.Encoding in project arctic-sea by 52North.
the class SweCommonEncoderv20 method createValues.
private XmlString createValues(List<List<String>> values, SweAbstractEncoding encoding) {
// TODO How to deal with the decimal separator - is it an issue here?
SweTextEncoding textEncoding = (SweTextEncoding) encoding;
String valueString = values.stream().map(block -> String.join(textEncoding.getTokenSeparator(), block)).collect(joining(textEncoding.getBlockSeparator()));
// create XB result object
XmlString xmlString = XmlString.Factory.newInstance(getXmlOptions());
xmlString.setStringValue(valueString);
return xmlString;
}
use of net.opengis.swe.x20.DataArrayType.Encoding in project arctic-sea by 52North.
the class GetResultTemplateResponseEncoder method createResultEncoding.
private ResultEncoding createResultEncoding(SosResultEncoding resultEncoding) throws EncodingException {
// TODO move encoding to SWECommonEncoder
final TextEncodingDocument xbEncoding;
if (resultEncoding.isEncoded()) {
try {
xbEncoding = TextEncodingDocument.Factory.parse(resultEncoding.getXml().get());
} catch (XmlException ex) {
throw unsupportedResultEncoding(ex);
}
} else {
XmlObject xml = encodeSwe(EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT), resultEncoding.get().get());
if (xml instanceof TextEncodingDocument) {
xbEncoding = (TextEncodingDocument) xml;
} else {
throw unsupportedResultEncoding();
}
}
ResultEncoding xbResultEncoding = ResultEncoding.Factory.newInstance(getXmlOptions());
xbResultEncoding.addNewAbstractEncoding().set(xbEncoding.getTextEncoding());
XmlHelper.substituteElement(xbResultEncoding.getAbstractEncoding(), xbEncoding.getTextEncoding());
return xbResultEncoding;
}
Aggregations