use of net.opengis.waterml.x20.MeasurementTimeseriesMetadataType in project arctic-sea by 52North.
the class WmlTVPEncoderv20 method addTimeseriesMetadata.
private void addTimeseriesMetadata(MeasurementTimeseriesType mtt, String gmlId, TimeseriesMetadata timeseriesMetadata) {
MeasurementTimeseriesMetadataType mtmt = (MeasurementTimeseriesMetadataType) mtt.addNewMetadata().addNewTimeseriesMetadata().substitute(WaterMLConstants.QN_MEASUREMENT_TIMESERIES_METADATA, MeasurementTimeseriesMetadataType.type);
createMeasurementTimeseriesMetadataType(mtmt, gmlId);
if (timeseriesMetadata != null && timeseriesMetadata.getClass().isAssignableFrom(MeasurementTimeseriesMetadata.class)) {
mtmt.setCumulative(((MeasurementTimeseriesMetadata) timeseriesMetadata).isCumulative());
}
}
use of net.opengis.waterml.x20.MeasurementTimeseriesMetadataType in project arctic-sea by 52North.
the class WmlTVPEncoderv20Test method shouldEncodeCumulativeProperty.
@Test
public void shouldEncodeCumulativeProperty() throws EncodingException {
mv.setMetadata(new Metadata().setTimeseriesmetadata(new MeasurementTimeseriesMetadata().setCumulative(true)));
XmlObject encodedElement = encoder.encode(mv);
Assert.assertThat(((MeasurementTimeseriesMetadataType) ((MeasurementTimeseriesDocument) encodedElement).getTimeseries().getMetadata().getTimeseriesMetadata()).getCumulative(), Is.is(true));
}
use of net.opengis.waterml.x20.MeasurementTimeseriesMetadataType in project arctic-sea by 52North.
the class WmlTVPEncoderv20Test method shouldSetDefaultCumulativeProperty.
@Test
public void shouldSetDefaultCumulativeProperty() throws EncodingException {
XmlObject encodedElement = encoder.encode(mv);
Assert.assertThat(encodedElement, CoreMatchers.instanceOf(MeasurementTimeseriesDocument.class));
final MeasurementTimeseriesDocument measurementTimeseriesDocument = (MeasurementTimeseriesDocument) encodedElement;
Assert.assertThat(measurementTimeseriesDocument.getTimeseries().isSetMetadata(), Is.is(true));
Assert.assertThat(measurementTimeseriesDocument.getTimeseries().getMetadata().getTimeseriesMetadata(), CoreMatchers.instanceOf(MeasurementTimeseriesMetadataType.class));
final MeasurementTimeseriesMetadataType measurementTimeseriesMetadataType = (MeasurementTimeseriesMetadataType) measurementTimeseriesDocument.getTimeseries().getMetadata().getTimeseriesMetadata();
Assert.assertThat(measurementTimeseriesMetadataType.isSetCumulative(), Is.is(true));
Assert.assertThat(measurementTimeseriesMetadataType.getCumulative(), Is.is(false));
}
Aggregations