Class OpenEHRDateTimeSerializationUtils

java.lang.Object
org.ehrbase.openehr.sdk.util.OpenEHRDateTimeSerializationUtils

public final class OpenEHRDateTimeSerializationUtils extends Object
This helper class is used to work around some Archie issues with date/time parsing accepting invalid years or not following the specified format fully (i.e. 2023-13, ignoring leap years)
  • Field Details

    • ISO_8601_DATE_FORMATTER

      public static final DateTimeFormatter ISO_8601_DATE_FORMATTER
    • ISO_8601_TIME_FORMATTER

      public static final DateTimeFormatter ISO_8601_TIME_FORMATTER
    • ISO_8601_DATE_TIME_FORMATTER

      public static final DateTimeFormatter ISO_8601_DATE_TIME_FORMATTER
  • Method Details

    • formatDate

      public static String formatDate(TemporalAccessor date)
    • formatTime

      public static String formatTime(TemporalAccessor time)
    • formatDateTime

      public static String formatDateTime(TemporalAccessor dateTime)
    • toMagnitude

      public static Long toMagnitude(com.nedap.archie.rm.datavalues.quantity.datetime.DvDate date)
      Archie does not support partial dates for getMagnitude. This method will assume first day/month if missing. As the openEHR spec defines year as the minimum, a non-null input will throw an Exception if ChronoField.YEAR is not supported.
      Parameters:
      date -
      Returns:
    • toMagnitude

      public static Long toMagnitude(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime dateTime)
      Archie does not support partial date-times for getMagnitude. This method will assume first day/month and 0 for time components if missing. As the openEHR spec defines year as the minimum, a non-null input will throw an Exception if ChronoField.YEAR is not supported.
      Parameters:
      dateTime -
      Returns:
    • toMagnitude

      public static Double toMagnitude(com.nedap.archie.rm.datavalues.quantity.datetime.DvTime time)
      Archie does not support partial times for getMagnitude. This method will assume 0 for fields not within the precision. As the openEHR spec defines hour as the minimum, a non-null input will throw an Exception if ChronoField.MINUTE_OF_HOUR is not supported.
      Parameters:
      time -
      Returns: