use of org.n52.svalbard.encode.exception.EncodingException in project arctic-sea by 52North.
the class AbstractOmEncoderv20 method encodeResultQualities.
private void encodeResultQualities(OMObservationType xbObservation, Set<OmResultQuality> resultQuality) throws EncodingException {
for (OmResultQuality quality : resultQuality) {
AbstractDQElementDocument encodedQuality = (AbstractDQElementDocument) encodeObjectToXml(null, quality, EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT));
DQElementPropertyType addNewResultQuality = xbObservation.addNewResultQuality();
addNewResultQuality.setAbstractDQElement(encodedQuality.getAbstractDQElement());
XmlHelper.substituteElement(addNewResultQuality.getAbstractDQElement(), encodedQuality.getAbstractDQElement());
}
}
use of org.n52.svalbard.encode.exception.EncodingException in project arctic-sea by 52North.
the class AbstractOmEncoderv20 method setFeatureOfInterest.
private void setFeatureOfInterest(OmObservation observation, OMObservationType xb) throws EncodingException {
AbstractFeature foi = observation.getObservationConstellation().getFeatureOfInterest();
XmlObject xbFoi = encodeFeatureOfInterest(foi);
xb.addNewFeatureOfInterest().set(xbFoi);
}
use of org.n52.svalbard.encode.exception.EncodingException in project arctic-sea by 52North.
the class AbstractOmEncoderv20 method setMetaDataProperty.
private void setMetaDataProperty(OmObservation sosObservation, OMObservationType xbObservation) throws EncodingException {
if (sosObservation.isSetMetaDataProperty()) {
for (AbstractMetaData abstractMetaData : sosObservation.getMetaDataProperty()) {
XmlObject encodeObject = encodeGML(abstractMetaData);
XmlObject substituteElement = XmlHelper.substituteElement(xbObservation.addNewMetaDataProperty().addNewAbstractMetaData(), encodeObject);
substituteElement.set(encodeObject);
}
}
}
use of org.n52.svalbard.encode.exception.EncodingException in project arctic-sea by 52North.
the class AbstractCoverageEncoder method encodeValueList.
/**
* Encode value list of {@link RangeSetType} from {@link DiscreteCoverage}
*
* @param rst
* The {@link RangeSetType} to encode value list for
* @param discreteCoverage
* The {@link DiscreteCoverage} with the value list
* @throws EncodingException
* If an error occurs
*/
protected void encodeValueList(RangeSetType rst, DiscreteCoverage<?> discreteCoverage) throws EncodingException {
List<?> list = getList(discreteCoverage);
Value<?> value = discreteCoverage.getRangeSet().iterator().next();
if (value instanceof BooleanValue) {
BooleanListDocument bld = BooleanListDocument.Factory.newInstance(getXmlOptions());
bld.setBooleanList(list);
rst.set(bld);
} else if (value instanceof CategoryValue || value instanceof TextValue) {
DataBlockType dbt = rst.addNewDataBlock();
dbt.addNewRangeParameters().setHref(discreteCoverage.getRangeParameters());
CoordinatesType ct = dbt.addNewTupleList();
ct.setCs(",");
ct.setStringValue(Joiner.on(",").join(list));
} else if (value instanceof CountValue) {
CountListDocument cld = CountListDocument.Factory.newInstance(getXmlOptions());
cld.setCountList(list);
rst.set(cld);
} else if (value instanceof QuantityValue) {
QuantityListDocument qld = QuantityListDocument.Factory.newInstance(getXmlOptions());
MeasureOrNilReasonListType monrlt = qld.addNewQuantityList();
if (discreteCoverage.isSetUnit()) {
monrlt.setUom(discreteCoverage.getUnit());
} else if (value.isSetUnit()) {
monrlt.setUom(value.getUnit());
}
monrlt.setListValue(list);
rst.set(qld);
}
}
use of org.n52.svalbard.encode.exception.EncodingException in project arctic-sea by 52North.
the class AbstractEnvironmentalMonitoringFaciltityEncoder method setRelatedTo.
private void setRelatedTo(EnvironmentalMonitoringFacilityType emft, EnvironmentalMonitoringFacility environmentalMonitoringFacility) throws EncodingException {
if (environmentalMonitoringFacility.isSetRelatedTo()) {
for (AnyDomainLink relatedTo : environmentalMonitoringFacility.getRelatedTo()) {
if (relatedTo.isSetSimpleAttrs()) {
RelatedTo rt = emft.addNewRelatedTo();
rt.setHref(relatedTo.getSimpleAttrs().getHref());
if (relatedTo.getSimpleAttrs().isSetTitle()) {
rt.setTitle(relatedTo.getSimpleAttrs().getTitle());
}
} else {
emft.addNewRelatedTo().addNewAnyDomainLink().set(encodeEF(relatedTo));
}
}
}
}
Aggregations