Search in sources :

Example 1 with Iso8601Helpers

use of org.opendatakit.briefcase.reused.Iso8601Helpers in project briefcase by opendatakit.

the class AggregateCursor method from.

/**
 * Parses the provided cursor xml document and returns a new Cursor instance.
 */
public static Cursor from(String cursorXml) {
    if (cursorXml.isEmpty() || // Ona compatibility
    cursorXml.equals("0"))
        return AggregateCursor.empty();
    XmlElement root = XmlElement.from(cursorXml);
    Optional<OffsetDateTime> lastUpdate = root.findElement("attributeValue").flatMap(XmlElement::maybeValue).map(Iso8601Helpers::parseDateTime);
    Optional<String> lastReturnedValue = root.findElement("uriLastReturnedValue").flatMap(XmlElement::maybeValue);
    return new AggregateCursor(cursorXml, lastUpdate, lastReturnedValue);
}
Also used : OffsetDateTime(java.time.OffsetDateTime) Iso8601Helpers(org.opendatakit.briefcase.reused.Iso8601Helpers) XmlElement(org.opendatakit.briefcase.export.XmlElement)

Aggregations

OffsetDateTime (java.time.OffsetDateTime)1 XmlElement (org.opendatakit.briefcase.export.XmlElement)1 Iso8601Helpers (org.opendatakit.briefcase.reused.Iso8601Helpers)1