Enum Class AvailabilitySharing
- All Implemented Interfaces:
Serializable,Comparable<AvailabilitySharing>,Constable
Two states, on purpose. An earlier draft had three, with an
everyone above SHARED_SPACES. It is gone: on a gate that
decides who reads whose calendar, every extra value is another branch to
reason about and another boundary to pin, and the one it added is marginal
on an intranet where colleagues share spaces. What is lost is real and worth
saying: someone outside all of your spaces can no longer see your busy time.
For a scheduling assistant that is the right boundary, and if the
cross-department case ever arrives, putting everyone back is a
widening — the safe direction — whereas withdrawing it later would
take away a visibility people had already opted into.
Whatever the value, what is ever disclosed is the same: busy and free blocks. Never a title, a location, an attendee or a calendar name. This enum only widens or narrows who may ask, never what comes back, which is what makes counting events materialised from a connected account defensible: their content is never shown.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionNobody may see when this user is busy.The people who are members of at least one of the same spaces may see when this user is busy. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AvailabilitySharingWhat a user gets when they have never touched the setting. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()Returns the token this constant is stored and exchanged as.static Optional<AvailabilitySharing> Resolves a stored or submitted token.static AvailabilitySharingReturns the enum constant of this class with the specified name.static AvailabilitySharing[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SHARED_SPACES
The people who are members of at least one of the same spaces may see when this user is busy. This is the default, and the "on" side of the switch: it matches how the rest of the product decides who sees a user's activity, and defaulting toNOBODYwould leave a setting nobody has a reason to open turning agent-assisted scheduling off for everybody. -
NOBODY
Nobody may see when this user is busy. Their calendar remains readable by the rules that apply anyway — chiefly, by themselves.
-
-
Field Details
-
DEFAULT
What a user gets when they have never touched the setting.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getValue
Returns the token this constant is stored and exchanged as. It is the lower-case, hyphenated spelling rather thanEnum.name()so that the stored value, the REST payload and the setting the user reads about are one and the same string.- Returns:
- the stored token, never
null
-
parse
Resolves a stored or submitted token.An unrecognised token is deliberately not mapped onto
DEFAULT: absence of a value means "this user never chose", which is what the default answers, whereas a value that exists but cannot be read is a broken store, and answering a broken store with the sharing default would widen a disclosure on the strength of a typo. The caller decides, and this method only says whether it knew the token.The retired
everyonetoken falls under exactly that rule: a blob written while the third value existed is unknown here, and resolves toNOBODYat the one place that reads it. Retiring a value fails closed.- Parameters:
value- the token to resolve, may benullor blank- Returns:
- the matching constant, or
Optional.empty()when the token is missing or unknown
-