Record Class CalendarOwner

java.lang.Object
java.lang.Record
org.exoplatform.caldav.service.CalendarOwner
Record Components:
identityId - the social identity of the owning eXo user, or null
username - that user's eXo login, or null
displayName - how to name the owner to the viewer, or null

public record CalendarOwner(Long identityId, String username, String displayName) extends Record
Who a shared calendar belongs to, as far as the viewer may be told (EXO-90237).

Two grains, matching the two witnesses CollectionOwnership hears. When this deployment recognised a colleague's eXo calendar, the owner is one of its users and all three fields are set — identity, login and full name — so agenda can show the person, avatar and popover included. When only the server said the collection is somebody else's, its owner principal is an eXo user only when exactly one user of this deployment is connected to that server as that principal (EXO-90243), and is then named the same way; otherwise the owner is a display name alone: what the principal calls itself, or failing that the last segment of the path the server returned. NONE is the answer for the user's own calendars and for a share whose owner cannot be named.

Services-local like its sibling enum: computed per listing, persisted nowhere, and copied field by field onto the API's RemoteCalendar.

  • Field Details

    • NONE

      public static final CalendarOwner NONE
      Nobody to name: the user's own calendar, or a share of unknown owner.
  • Constructor Details

    • CalendarOwner

      public CalendarOwner(Long identityId, String username, String displayName)
      Creates an instance of a CalendarOwner record class.
      Parameters:
      identityId - the value for the identityId record component
      username - the value for the username record component
      displayName - the value for the displayName record component
  • Method Details

    • named

      public static CalendarOwner named(String displayName)
      An owner known only by the name the server gives them.
      Parameters:
      displayName - what to call them; null when even that is unknown
      Returns:
      the owner, NONE when the name is null
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • identityId

      public Long identityId()
      Returns the value of the identityId record component.
      Returns:
      the value of the identityId record component
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • displayName

      public String displayName()
      Returns the value of the displayName record component.
      Returns:
      the value of the displayName record component