use of org.n52.shetland.iso.gmd.GmlBaseUnit in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodeGmdQuantitativeResult.
private void encodeGmdQuantitativeResult(DQResultPropertyType xbResult, GmdQuantitativeResult gmdQuantitativeResult) {
DQQuantitativeResultType dqQuantitativeResultType = (DQQuantitativeResultType) xbResult.addNewAbstractDQResult().substitute(QN_GMD_QUANTITATIVE_RESULT, DQQuantitativeResultType.type);
GmlBaseUnit unit = gmdQuantitativeResult.getUnit();
UnitOfMeasurePropertyType valueUnit = dqQuantitativeResultType.addNewValueUnit();
BaseUnitType xbBaseUnit = (BaseUnitType) valueUnit.addNewUnitDefinition().substitute(QN_GML_BASE_UNIT, BaseUnitType.type);
CodeType xbCatalogSymbol = xbBaseUnit.addNewCatalogSymbol();
xbCatalogSymbol.setCodeSpace(unit.getCatalogSymbol().getCodeSpace().toString());
xbCatalogSymbol.setStringValue(unit.getCatalogSymbol().getValue());
xbBaseUnit.setId(unit.getId());
xbBaseUnit.addNewUnitsSystem().setHref(unit.getUnitSystem());
xbBaseUnit.addNewIdentifier().setCodeSpace(unit.getIdentifier());
if (gmdQuantitativeResult.isSetValueNilReason()) {
dqQuantitativeResultType.addNewValue().setNilReason(gmdQuantitativeResult.getValueNilReason().name());
} else {
XmlCursor cursor = dqQuantitativeResultType.addNewValue().addNewRecord().newCursor();
cursor.toNextToken();
cursor.insertChars(gmdQuantitativeResult.getValue());
cursor.dispose();
}
}
Aggregations