Search in sources :

Example 6 with DateTimeParseException

use of org.n52.shetland.util.DateTimeParseException in project arctic-sea by 52North.

the class GmlDecoderv321 method parseTimePosition.

private TimeInstant parseTimePosition(TimePositionType xbTimePosition) throws DecodingException {
    TimeInstant ti = new TimeInstant();
    String timeString = xbTimePosition.getStringValue();
    if (timeString != null && !timeString.isEmpty()) {
        try {
            // TODO better differentiate between ISO8601 and indeterminate
            // value
            ti.setValue(DateTimeHelper.parseIsoString2DateTime(timeString));
            ti.setRequestedTimeLength(DateTimeHelper.getTimeLengthBeforeTimeZone(timeString));
        } catch (DateTimeParseException ex) {
            ti.setIndeterminateValue(new IndeterminateValue(timeString));
        }
    }
    if (xbTimePosition.isSetIndeterminatePosition()) {
        ti.setIndeterminateValue(new IndeterminateValue(xbTimePosition.getIndeterminatePosition().toString()));
    }
    return ti;
}
Also used : DateTimeParseException(org.n52.shetland.util.DateTimeParseException) IndeterminateValue(org.n52.shetland.ogc.gml.time.IndeterminateValue) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant)

Aggregations

DateTime (org.joda.time.DateTime)4 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 List (java.util.List)2 XmlObject (org.apache.xmlbeans.XmlObject)2 IndeterminateValue (org.n52.shetland.ogc.gml.time.IndeterminateValue)2 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)2 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)2 RangeValue (org.n52.shetland.ogc.swe.RangeValue)2 SweAllowedTimes (org.n52.shetland.ogc.swe.simpleType.SweAllowedTimes)2 DateTimeParseException (org.n52.shetland.util.DateTimeParseException)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 DateTimeParseException (java.time.format.DateTimeParseException)1 Time (org.n52.shetland.ogc.gml.time.Time)1 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)1 SweField (org.n52.shetland.ogc.swe.SweField)1 SweTime (org.n52.shetland.ogc.swe.simpleType.SweTime)1 SweTimeRange (org.n52.shetland.ogc.swe.simpleType.SweTimeRange)1