Class AgendaCalendarSubscriptionServiceImpl
- All Implemented Interfaces:
org.exoplatform.agenda.service.AgendaCalendarSubscriptionService
Owners. A subscription belongs to the owner of the calendar it fills: a
user, who alone manages it, or a space, whose real managers manage it whoever
added it. A space's calendar is a storage detail: it takes the space's colour,
its events have no attendee row, and every reader of the space's calendar
reads them by owner; an attendee-keyed listing reaches them only when it asks
for the owners' subscribed calendars
(EventFilter#subscribedCalendarsIncluded).
Stored events. A subscription fills a calendar of its own,
flagged as a subscription, with one agenda event per occurrence of the feed in
the window — so imported events appear in every view, the search and the
preview like any other. They are written through AgendaEventStorage,
never through AgendaEventService: no creation, update or deletion is
broadcast, so nothing imported sends an invitation or a notification, computes
a reminder, earns points, or reaches a connector's listeners; the search index
is kept in step directly. The calendar flag is what makes them read-only
(AgendaEventServiceImpl#canUpdateEvent) and what keeps the calendar out
of the listings a connector binds remote collections from.
Reading a link. A link of this very eXo — its public domain and the
path of a published calendar — is read in the process, through
AgendaCalendarLinkService, with the token checks the anonymous feed
applies; and refused when the calendar it publishes is one the user already
sees — for a space, when it is one of the space's own. Every other link is
read by CalendarFeedFetcher, whose guard
decides which addresses the platform may reach.
Refreshing. A refresh is claimed in the database before it runs, by the scheduled job on every node and by the owner's "refresh now" alike, so a single node reads a feed at a time. It sends the validators of the last read, skips a body identical to the last one imported, rewrites only the occurrences that changed and removes those the feed dropped. A failure keeps the last good copy and records its message code.
Secrets. Feed URLs often embed one; a URL is stored encrypted with the platform codec, compared through a digest, returned to whoever manages the subscription only, and never logged.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe user already subscribes to this URL.static final DurationAge after which a refresh claim is taken over.static final DurationRefresh interval of a feed that advertises none.static final intDays of future occurrences imported.static final StringA colour that is not#RRGGBB.static final DurationShortest time between two refreshes asked by the owner.static final intMost occurrences imported per subscription.static final intLongest calendar name.static final intMost links one user may have read at the same time on one node, through checking, subscribing, editing and refreshing: a user looping on slow hosts would otherwise hold the connections the scheduled refresh and every other user share.static final DurationLongest refresh interval honoured.static final intMost subscriptions a user holds.static final DurationShortest refresh interval honoured.static final StringA name longer than allowed.static final intDays of past occurrences imported.static final StringA refresh failed for a reason of the platform's.static final StringA refresh is running.static final StringA refresh was asked a moment ago.static final DurationWait before retrying a subscription that cannot be refreshed at all.static final DurationWait before retrying a failed refresh.static final StringThe user already has as many links being read as allowed.static final StringThe user holds the most subscriptions allowed.static final StringThe stored URL cannot be decrypted: the platform codec key was replaced.static final StringThe owner's account is disabled or deleted.static final DurationHow long a withdrawn link of this eXo keeps its last imported copy: past it, the imported events are removed and the subscription keeps its error (EXO-90373). -
Constructor Summary
ConstructorsConstructorDescriptionAgendaCalendarSubscriptionServiceImpl(CalendarSubscriptionStorage subscriptionStorage, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, AgendaEventStorage agendaEventStorage, AgendaEventAttendeeStorage attendeeStorage, org.exoplatform.agenda.service.AgendaCalendarLinkService calendarLinkService, CalendarFeedFetcher feedFetcher, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.web.security.codec.CodecInitializer codecInitializer, org.exoplatform.commons.search.index.IndexingService indexingService, org.exoplatform.social.core.manager.ActivityManager activityManager) Builds the service. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanManageSubscriptions(long ownerIdentityId, String username) org.exoplatform.agenda.model.CalendarSubscriptioncreateSubscription(String url, String name, String color, long ownerIdentityId, String username) org.exoplatform.agenda.model.CalendarSubscriptioncreateSubscription(String url, String name, String color, String username) voiddeleteCalendarSubscription(long calendarId) voiddeleteSubscription(long subscriptionId, String username) voidfollowSpaceColor(org.exoplatform.agenda.model.Calendar calendar) org.exoplatform.agenda.model.CalendarSubscriptiongetSubscription(long subscriptionId, String username) getSubscriptionCalendarIds(List<Long> ownerIdentityIds) List<org.exoplatform.agenda.model.CalendarSubscription> getSubscriptions(long ownerIdentityId, String username) List<org.exoplatform.agenda.model.CalendarSubscription> getSubscriptions(String username) intrefreshDueSubscriptions(int batchSize) org.exoplatform.agenda.model.CalendarSubscriptionrefreshSubscription(long subscriptionId, String username) org.exoplatform.agenda.model.CalendarSubscriptionupdateSubscription(long subscriptionId, String url, String name, String color, String username)
-
Field Details
-
PAST_DAYS
public static final int PAST_DAYSDays of past occurrences imported.- See Also:
-
FUTURE_DAYS
public static final int FUTURE_DAYSDays of future occurrences imported.- See Also:
-
MAX_EVENTS
public static final int MAX_EVENTSMost occurrences imported per subscription.- See Also:
-
MAX_SUBSCRIPTIONS
public static final int MAX_SUBSCRIPTIONSMost subscriptions a user holds.- See Also:
-
DEFAULT_REFRESH
Refresh interval of a feed that advertises none. -
MIN_REFRESH
Shortest refresh interval honoured. -
MAX_REFRESH
Longest refresh interval honoured. -
RETRY_AFTER_FAILURE
Wait before retrying a failed refresh. -
RETRY_AFTER_DEAD_END
Wait before retrying a subscription that cannot be refreshed at all. -
WITHDRAWN_LINK_PURGE
How long a withdrawn link of this eXo keeps its last imported copy: past it, the imported events are removed and the subscription keeps its error (EXO-90373). -
MANUAL_REFRESH_INTERVAL
Shortest time between two refreshes asked by the owner. -
CLAIM_STALE
Age after which a refresh claim is taken over. -
MAX_NAME
public static final int MAX_NAMELongest calendar name.- See Also:
-
ALREADY_SUBSCRIBED
The user already subscribes to this URL.- See Also:
-
TOO_MANY_SUBSCRIPTIONS
The user holds the most subscriptions allowed.- See Also:
-
URL_UNREADABLE
The stored URL cannot be decrypted: the platform codec key was replaced.- See Also:
-
REFRESH_TOO_SOON
A refresh was asked a moment ago.- See Also:
-
REFRESH_IN_PROGRESS
A refresh is running.- See Also:
-
REFRESH_FAILED
A refresh failed for a reason of the platform's.- See Also:
-
USER_DISABLED
The owner's account is disabled or deleted.- See Also:
-
NAME_TOO_LONG
A name longer than allowed.- See Also:
-
INVALID_COLOR
A colour that is not#RRGGBB.- See Also:
-
TOO_MANY_READS
The user already has as many links being read as allowed.- See Also:
-
MAX_READS_PER_USER
public static final int MAX_READS_PER_USERMost links one user may have read at the same time on one node, through checking, subscribing, editing and refreshing: a user looping on slow hosts would otherwise hold the connections the scheduled refresh and every other user share.- See Also:
-
-
Constructor Details
-
AgendaCalendarSubscriptionServiceImpl
@Autowired public AgendaCalendarSubscriptionServiceImpl(CalendarSubscriptionStorage subscriptionStorage, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, AgendaEventStorage agendaEventStorage, AgendaEventAttendeeStorage attendeeStorage, org.exoplatform.agenda.service.AgendaCalendarLinkService calendarLinkService, CalendarFeedFetcher feedFetcher, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.web.security.codec.CodecInitializer codecInitializer, org.exoplatform.commons.search.index.IndexingService indexingService, org.exoplatform.social.core.manager.ActivityManager activityManager) Builds the service.- Parameters:
subscriptionStorage- the subscription rowsagendaCalendarService- creates, reads and deletes the calendarsagendaEventStorage- writes the imported events without broadcastingattendeeStorage- writes the owner as the attendee of an imported eventcalendarLinkService- reads the links of this eXofeedFetcher- reads every other linkidentityManager- resolves usersspaceService- resolves space membershipscodecInitializer- the platform codec URLs are encrypted withindexingService- keeps the search index in step with the imported eventsactivityManager- posts the activity announcing a space's subscription
-
-
Method Details
-
getSubscriptions
public List<org.exoplatform.agenda.model.CalendarSubscription> getSubscriptions(String username) throws IllegalAccessException - Specified by:
getSubscriptionsin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
IllegalAccessException
-
getSubscriptions
public List<org.exoplatform.agenda.model.CalendarSubscription> getSubscriptions(long ownerIdentityId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
getSubscriptionsin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
canManageSubscriptions
- Specified by:
canManageSubscriptionsin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService
-
getSubscription
public org.exoplatform.agenda.model.CalendarSubscription getSubscription(long subscriptionId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
getSubscriptionin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
checkUrl
- Specified by:
checkUrlin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
IllegalAccessException
-
checkUrl
public String checkUrl(String url, long ownerIdentityId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
checkUrlin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
createSubscription
public org.exoplatform.agenda.model.CalendarSubscription createSubscription(String url, String name, String color, String username) throws IllegalAccessException - Specified by:
createSubscriptionin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
IllegalAccessException
-
createSubscription
public org.exoplatform.agenda.model.CalendarSubscription createSubscription(String url, String name, String color, long ownerIdentityId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
createSubscriptionin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
updateSubscription
public org.exoplatform.agenda.model.CalendarSubscription updateSubscription(long subscriptionId, String url, String name, String color, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
updateSubscriptionin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
refreshSubscription
public org.exoplatform.agenda.model.CalendarSubscription refreshSubscription(long subscriptionId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
refreshSubscriptionin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
deleteSubscription
public void deleteSubscription(long subscriptionId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Specified by:
deleteSubscriptionin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
deleteCalendarSubscription
public void deleteCalendarSubscription(long calendarId) - Specified by:
deleteCalendarSubscriptionin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService
-
getSubscriptionCalendarIds
- Specified by:
getSubscriptionCalendarIdsin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService
-
followSpaceColor
public void followSpaceColor(org.exoplatform.agenda.model.Calendar calendar) - Specified by:
followSpaceColorin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService
-
refreshDueSubscriptions
public int refreshDueSubscriptions(int batchSize) - Specified by:
refreshDueSubscriptionsin interfaceorg.exoplatform.agenda.service.AgendaCalendarSubscriptionService
-