Search in sources :

Example 1 with MeasurementTimeLocationValueTripleType

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;
}
Also used : CountValue(org.n52.shetland.ogc.om.values.CountValue) MeasurementTimeLocationValueTripleType(eu.europa.ec.inspire.schemas.omso.x30.MeasurementTimeLocationValueTripleType) QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue)

Aggregations

MeasurementTimeLocationValueTripleType (eu.europa.ec.inspire.schemas.omso.x30.MeasurementTimeLocationValueTripleType)1 CountValue (org.n52.shetland.ogc.om.values.CountValue)1 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)1