use of eu.europa.ec.inspire.schemas.omso.x30.MeasurementTimeLocationValueTripleType in project arctic-sea by 52North.
the class AbstractTimeLocationValueTripleTypeEncoder method createMeasurementTimeLocationValueTripleType.
/**
* Create a {@link MeasurementTimeLocationValueTripleType} from
* {@link TimeLocationValueTriple}
*
* @param timeLocationValueTriple
* The {@link TimeLocationValueTriple} to encode
* @return The encoded {@link TimeLocationValueTriple}
* @throws EncodingException
* If an error occurs
*/
private TimeValuePairType createMeasurementTimeLocationValueTripleType(TimeLocationValueTriple timeLocationValueTriple) throws EncodingException {
MeasurementTimeLocationValueTripleType mtlvtt = MeasurementTimeLocationValueTripleType.Factory.newInstance();
mtlvtt.addNewTime().setStringValue(getTimeString(timeLocationValueTriple.getTime()));
mtlvtt.addNewLocation().addNewPoint().set(encodeGML(timeLocationValueTriple.getLocation()));
String value = null;
if (timeLocationValueTriple.getValue() instanceof QuantityValue) {
QuantityValue quantityValue = (QuantityValue) timeLocationValueTriple.getValue();
if (quantityValue.isSetValue()) {
value = quantityValue.getValue().toPlainString();
}
} else if (timeLocationValueTriple.getValue() instanceof CountValue) {
CountValue countValue = (CountValue) timeLocationValueTriple.getValue();
if (countValue.getValue() != null) {
value = Integer.toString(countValue.getValue().intValue());
}
}
if (value != null && !value.isEmpty()) {
mtlvtt.addNewValue().setStringValue(value);
} else {
mtlvtt.addNewValue().setNil();
mtlvtt.addNewMetadata().addNewTVPMeasurementMetadata().addNewNilReason().setNilReason(MISSING);
}
return mtlvtt;
}
Aggregations