Search in sources :

Example 1 with SweAllowedTimes

use of org.n52.shetland.ogc.swe.simpleType.SweAllowedTimes in project arctic-sea by 52North.

the class SweCommonDecoderV101 method parseAllowedTimes.

@SuppressWarnings({ "unchecked", "rawtypes" })
private SweAllowedTimes parseAllowedTimes(AllowedTimes att) throws DateTimeParseException {
    SweAllowedTimes allowedTimes = new SweAllowedTimes();
    if (att.isSetId()) {
        allowedTimes.setGmlId(att.getId());
    }
    if (CollectionHelper.isNotNullOrEmpty(att.getValueListArray())) {
        for (List list : att.getValueListArray()) {
            if (CollectionHelper.isNotEmpty(list)) {
                for (Object value : list) {
                    allowedTimes.addValue(DateTimeHelper.parseIsoString2DateTime(value.toString()));
                }
            }
        }
    }
    if (CollectionHelper.isNotNullOrEmpty(att.getIntervalArray())) {
        for (List interval : att.getIntervalArray()) {
            RangeValue<DateTime> rangeValue = new RangeValue<DateTime>();
            Iterator iterator = interval.iterator();
            if (iterator.hasNext()) {
                rangeValue.setRangeStart(DateTimeHelper.parseIsoString2DateTime(iterator.next().toString()));
            }
            if (iterator.hasNext()) {
                rangeValue.setRangeEnd(DateTimeHelper.parseIsoString2DateTime(iterator.next().toString()));
            }
            allowedTimes.addInterval(rangeValue);
        }
    }
    return allowedTimes;
}
Also used : Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) XmlObject(org.apache.xmlbeans.XmlObject) SweAllowedTimes(org.n52.shetland.ogc.swe.simpleType.SweAllowedTimes) DateTime(org.joda.time.DateTime) RangeValue(org.n52.shetland.ogc.swe.RangeValue)

Example 2 with SweAllowedTimes

use of org.n52.shetland.ogc.swe.simpleType.SweAllowedTimes in project arctic-sea by 52North.

the class SweCommonDecoderV20 method parseAllowedTimes.

@SuppressWarnings("rawtypes")
private SweAllowedTimes parseAllowedTimes(AllowedTimesType att) throws DateTimeParseException {
    SweAllowedTimes allowedTimes = new SweAllowedTimes();
    if (att.isSetId()) {
        allowedTimes.setGmlId(att.getId());
    }
    if (CollectionHelper.isNotNullOrEmpty(att.getValueArray())) {
        for (Object value : att.getValueArray()) {
            allowedTimes.addValue(DateTimeHelper.parseIsoString2DateTime(value.toString()));
        }
    }
    if (CollectionHelper.isNotNullOrEmpty(att.getIntervalArray())) {
        for (List interval : att.getIntervalArray()) {
            RangeValue<DateTime> rangeValue = new RangeValue<DateTime>();
            Iterator iterator = interval.iterator();
            if (iterator.hasNext()) {
                rangeValue.setRangeStart(DateTimeHelper.parseIsoString2DateTime(iterator.next().toString()));
            }
            if (iterator.hasNext()) {
                rangeValue.setRangeEnd(DateTimeHelper.parseIsoString2DateTime(iterator.next().toString()));
            }
            allowedTimes.addInterval(rangeValue);
        }
    }
    if (att.isSetSignificantFigures()) {
        allowedTimes.setSignificantFigures(att.getSignificantFigures());
    }
    return allowedTimes;
}
Also used : Iterator(java.util.Iterator) XmlObject(org.apache.xmlbeans.XmlObject) List(java.util.List) ArrayList(java.util.ArrayList) SweAllowedTimes(org.n52.shetland.ogc.swe.simpleType.SweAllowedTimes) DateTime(org.joda.time.DateTime) RangeValue(org.n52.shetland.ogc.swe.RangeValue)

Aggregations

ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 List (java.util.List)2 XmlObject (org.apache.xmlbeans.XmlObject)2 DateTime (org.joda.time.DateTime)2 RangeValue (org.n52.shetland.ogc.swe.RangeValue)2 SweAllowedTimes (org.n52.shetland.ogc.swe.simpleType.SweAllowedTimes)2