Package io.meeds.social.timezone.service
Class UserTimeZoneService
java.lang.Object
io.meeds.social.timezone.service.UserTimeZoneService
Holds the timezone of each user, the one his browser lives in, under the
profile attribute
Profile.USER_TIME_ZONE. The browser of the user
keeps it up to date on every page load, so that everything sent to him on a
schedule, starting with the digest mail notifications, goes out at the right
local hour. This synchronization used to live in the agenda addon and is now
owned by the platform, so that it works whatever the installed addons;
agenda delegates its own copy here.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringEvent broadcast when the timezone of a user is saved, with the username as source and the timezone as data. -
Constructor Summary
ConstructorsConstructorDescriptionUserTimeZoneService(org.exoplatform.services.organization.OrganizationService organizationService, org.exoplatform.services.listener.ListenerService listenerService) -
Method Summary
Modifier and TypeMethodDescriptiongetUserTimeZone(String username) voidsaveUserTimeZone(String username, String zoneId) Saves the timezone the browser of the user lives in, then broadcastsUSER_TIME_ZONE_SAVED_EVENTso that whatever keeps a copy of the timezone, like the digest work list, can refresh it.
-
Field Details
-
USER_TIME_ZONE_SAVED_EVENT
Event broadcast when the timezone of a user is saved, with the username as source and the timezone as data. A profile listener can't be used for that: it never fires when this attribute changes.- See Also:
-
-
Constructor Details
-
UserTimeZoneService
public UserTimeZoneService(org.exoplatform.services.organization.OrganizationService organizationService, org.exoplatform.services.listener.ListenerService listenerService)
-
-
Method Details
-
getUserTimeZone
- Parameters:
username- the user to read the timezone of- Returns:
- the timezone of the user, null when it is unknown: a user who never loaded a page has no timezone yet. The caller falls back to the server timezone.
-
saveUserTimeZone
Saves the timezone the browser of the user lives in, then broadcastsUSER_TIME_ZONE_SAVED_EVENTso that whatever keeps a copy of the timezone, like the digest work list, can refresh it.- Parameters:
username- the user to save the timezone ofzoneId- the timezone identifier, for example Europe/Paris- Throws:
IllegalArgumentException- when the timezone is not a known oneIllegalStateException- when the profile of the user can't be saved
-