Record Class CalendarCollection
- Record Components:
href- the collection's server-absolute raw path, trailing slash as the server sent itdisplayName- the collection's display name, or null — data, never identity: nothing may key on itctag- the CalendarServer ctag, or null when the server has nonesyncToken- the RFC 6578 sync token, or null when unsupportedcolor- the Apple calendar-color, or nullwritable- whether the current user's privilege set carries write — false as well when the server answered no privilege set at all, whichprivilegesAnsweredis there to tell apartcomponents- the component types the collection declares, empty when the server did not sayowner- theDAV:ownerof the collection as a server-absolute raw path, or null when the server answered none — the principal the collection belongs to, which is not always the user listing it (EXO-90235)privilegesAnswered- whether the server answered acurrent-user-privilege-setat all; false is the Google shape, wherewritablesays nothing because nothing was said
-
Constructor Summary
ConstructorsConstructorDescriptionCalendarCollection(String href, String displayName, String ctag, String syncToken, String color, boolean writable) A collection whose server declared no component set.CalendarCollection(String href, String displayName, String ctag, String syncToken, String color, boolean writable, Set<String> components) A collection whose server named no owner and answered no privilege set.CalendarCollection(String href, String displayName, String ctag, String syncToken, String color, boolean writable, Set<String> components, String owner, boolean privilegesAnswered) Creates an instance of aCalendarCollectionrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncolor()Returns the value of thecolorrecord component.Returns the value of thecomponentsrecord component.ctag()Returns the value of thectagrecord component.Returns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanWhether this collection holds events at all.href()Returns the value of thehrefrecord component.booleanisSharedWith(String currentUserPrincipal) Whether the server says this collection is somebody else's, granted to the user rather than owned by them.owner()Returns the value of theownerrecord component.ownerIfAnother(String currentUserPrincipal) The owner the server named, when it is somebody other than the user listing the collection — the principal worth naming as "who shared this" (EXO-90237).static StringprincipalPathOf(String path) A principal path in the one shape two answers of the same server can be compared in: percent-decoding undone, trailing slash dropped.booleanReturns the value of theprivilegesAnsweredrecord component.Returns the value of thesyncTokenrecord component.final StringtoString()Returns a string representation of this record class.booleanwritable()Returns the value of thewritablerecord component.
-
Constructor Details
-
CalendarCollection
public CalendarCollection(String href, String displayName, String ctag, String syncToken, String color, boolean writable) A collection whose server declared no component set.The six-argument form every caller used before the set was read: an undeclared set is an empty one, which
holdsEvents()reads as "the server did not say" — the RFC 4791 default of supporting everything. It names no owner and answers no privilege set either, so what it describes is a collection nothing has been said about — never a share (seeisSharedWith(String)).- Parameters:
href- the collection pathdisplayName- the name the server gives itctag- the collection change tagsyncToken- the RFC 6578 sync tokencolor- the colour the server carrieswritable- whether the caller may write to it
-
CalendarCollection
public CalendarCollection(String href, String displayName, String ctag, String syncToken, String color, boolean writable, Set<String> components) A collection whose server named no owner and answered no privilege set.The seven-argument form every caller used before ownership was read; it keeps meaning what it meant, a collection about which nothing beyond its own properties is known, so a record built by hand never classifies as a share by accident.
- Parameters:
href- the collection pathdisplayName- the name the server gives itctag- the collection change tagsyncToken- the RFC 6578 sync tokencolor- the colour the server carrieswritable- whether the caller may write to itcomponents- the component types it declares
-
CalendarCollection
public CalendarCollection(String href, String displayName, String ctag, String syncToken, String color, boolean writable, Set<String> components, String owner, boolean privilegesAnswered) Creates an instance of aCalendarCollectionrecord class.- Parameters:
href- the value for thehrefrecord componentdisplayName- the value for thedisplayNamerecord componentctag- the value for thectagrecord componentsyncToken- the value for thesyncTokenrecord componentcolor- the value for thecolorrecord componentwritable- the value for thewritablerecord componentcomponents- the value for thecomponentsrecord componentowner- the value for theownerrecord componentprivilegesAnswered- the value for theprivilegesAnsweredrecord component
-
-
Method Details
-
holdsEvents
public boolean holdsEvents()Whether this collection holds events at all.RFC 4791 §5.2.3 makes
supported-calendar-component-setoptional, and a collection that omits it supports every component. An empty set is therefore a server that did not say, not a server that said "nothing" — both answer true. Only an explicit set without VEVENT answers false, which is what keeps a task list from becoming a calendar.- Returns:
- true unless the server explicitly excluded events
-
ownerIfAnother
The owner the server named, when it is somebody other than the user listing the collection — the principal worth naming as "who shared this" (EXO-90237).The same comparison as the owner signal of
isSharedWith(String), answered as a path rather than a boolean. Needed because a collection can be a share by the privilege signal alone while still naming the user themself as owner — a calendar under their own home the server will not let them write — and naming that owner would tell the user the calendar was shared by themself. Null when the server named no owner, when the account's own principal is unknown (nothing to compare against, so nobody is named rather than possibly the user), and when the owner is the user.- Parameters:
currentUserPrincipal- the listing account's principal path, may be null or blank- Returns:
- the owner's server-absolute raw path when it names another principal, else null
-
principalPathOf
A principal path in the one shape two answers of the same server can be compared in: percent-decoding undone, trailing slash dropped.Decoded through
URIrather thanURLDecoder, which would also turn a+into a space — a transformation meant for form bodies, not paths. A valueURIcannot parse is compared as it came, trimmed of its slash: a malformed owner href is the server's to explain, and treating it as "another owner" would hide a calendar over a spelling.Public because it is also the form a connection's own principal is recorded in (EXO-90243): a principal stored in one spelling and an owner compared in another would fail to meet, and the owner of a share would never be recognised as the eXo user connected under that principal.
- Parameters:
path- a server-absolute raw path, not null- Returns:
- the comparable form
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
href
Returns the value of thehrefrecord component.- Returns:
- the value of the
hrefrecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
ctag
Returns the value of thectagrecord component.- Returns:
- the value of the
ctagrecord component
-
syncToken
Returns the value of thesyncTokenrecord component.- Returns:
- the value of the
syncTokenrecord component
-
color
Returns the value of thecolorrecord component.- Returns:
- the value of the
colorrecord component
-
writable
public boolean writable()Returns the value of thewritablerecord component.- Returns:
- the value of the
writablerecord component
-
components
Returns the value of thecomponentsrecord component.- Returns:
- the value of the
componentsrecord component
-
owner
Returns the value of theownerrecord component.- Returns:
- the value of the
ownerrecord component
-
privilegesAnswered
public boolean privilegesAnswered()Returns the value of theprivilegesAnsweredrecord component.- Returns:
- the value of the
privilegesAnsweredrecord component
-