[geotk] Question about mashalling an indeterminatePosition in a TimePeriod
François ANDRE
francois.andre.perso at gmail.com
Wed Jan 9 06:17:17 PST 2013
Hi,
I'm trying to mashall a TimePeriod whose endPosition is set to NOW.
I'm using geotk-metadata-3.20-sources.jar
My code is the following:
@Test
public void testIndeterminateTimePeriod() throws Exception
{
DefaultTemporalExtent defExtent = new DefaultTemporalExtent();
TimePositionType beginPosition = new
TimePositionType(Calendar.getInstance().getTime());
TimePeriodType period = new TimePeriodType(beginPosition);
period.setEndPosition(TimeIndeterminateValueType.NOW);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
defExtent.setExtent(period);
XML.marshal(defExtent, outputStream);
String result = outputStream.toString();
System.out.println(result);
}
But in the result, "now" is replaced by "after"
<gmd:extent>
<gml:TimePeriod gml:id="IZVD69">
<gml:beginPosition>2013-01-09T15:06:20+01:00</gml:beginPosition>
<gml:endPosition indeterminatePosition="after"/>
</gml:TimePeriod>
</gmd:extent>
I understand that this replacement is operated in the TimePeriod
constructor:
public TimePeriod(final Period period) {
super(period);
if (period != null) {
if (MarshalContext.versionGML(MarshalContext.GML_3_0)) {
begin = new TimePeriodBound.GML3(period.getBeginning(),
"before");
end = new TimePeriodBound.GML3(period.getEnding(),
"after");
} else {
begin = new TimePeriodBound.GML2(period.getBeginning());
end = new TimePeriodBound.GML2(period.getEnding());
}
}
}
But I don't understand the reason of the replacement : is it a bug or
should any indeterminated period be replaced by "after", or (more likely),
is it my code which is simply wrong ?
Cheers
François
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20130109/2ee65342/attachment.html>
More information about the Geotoolkit
mailing list