Record Class RemoteEventsRead

java.lang.Object
java.lang.Record
org.exoplatform.caldav.model.RemoteEventsRead
Record Components:
events - the occurrences that were read, each tagged with its calendar and colour; empty when the account could not be asked at all
failed - true when the account could not be asked, so the empty list above means "not read" rather than "nothing there"
failedCalendars - hrefs of the collections that were listed but could not be read; empty when every listed calendar answered

public record RemoteEventsRead(List<RemoteIcsEvent> events, boolean failed, List<String> failedCalendars) extends Record
What reading the connected account over a period actually produced, failures included.

A bare list of events cannot carry the one thing a client most needs to know. "This account holds no meeting this week" and "this account could not be reached" are both an empty array, and a caller that receives only the array has no way back to the distinction: it has to be told, or it will draw an empty week and call it the truth.

Two grains, because the failures come in two grains. failed says the account itself could not be asked — the server was unreachable, or it refused the stored credentials before any calendar was named — in which case nothing at all was read and events is necessarily empty. failedCalendars names the collections that were listed but could not then be read; the account answered, the other calendars' events are in events, and only the named ones are missing.

Partial answers are kept deliberately. Refusing the whole request when one collection of four fails would throw away three calendars' events to report the fourth, which is a worse agenda than the one the failure caused.

  • Constructor Details

    • RemoteEventsRead

      public RemoteEventsRead(List<RemoteIcsEvent> events, boolean failed, List<String> failedCalendars)
      Creates an instance of a RemoteEventsRead record class.
      Parameters:
      events - the value for the events record component
      failed - the value for the failed record component
      failedCalendars - the value for the failedCalendars record component
  • Method Details

    • empty

      public static RemoteEventsRead empty()
      The answer of an account that has nothing to say and no failure to report — most often one that is simply not connected.
      Returns:
      an empty, unfailed reading
    • unreachable

      public static RemoteEventsRead unreachable()
      The answer of an account that could not be asked at all.
      Returns:
      an empty reading that says so
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • events

      public List<RemoteIcsEvent> events()
      Returns the value of the events record component.
      Returns:
      the value of the events record component
    • failed

      public boolean failed()
      Returns the value of the failed record component.
      Returns:
      the value of the failed record component
    • failedCalendars

      public List<String> failedCalendars()
      Returns the value of the failedCalendars record component.
      Returns:
      the value of the failedCalendars record component