Class AgendaCalendarSubscriptionRest
ownerId (EXO-90373).
No rule lives here. Who may read or change a subscription, which links
may be read and what is imported are AgendaCalendarSubscriptionService's;
this resource maps its exceptions to statuses: 404 for a subscription or an
owner that does not exist, 403 for one the user may not manage, 400 with the refusal's
message code, 429 for a refresh asked a moment ago or too many reads at once,
and 409 for a refresh already running. The asking user comes from the session,
never from a parameter. Responses carry URLs, which may embed a secret, and
are never cached.
A refusal writes its own body, {"message": "<code>"}, never
cached like every response here: the code the drawer shows and the cache header
do not depend on how the platform configures Spring's error page.
-
Constructor Summary
ConstructorsConstructorDescriptionAgendaCalendarSubscriptionRest(org.exoplatform.agenda.service.AgendaCalendarSubscriptionService subscriptionService) Builds the resource. -
Method Summary
Modifier and TypeMethodDescriptioncheckUrl(jakarta.servlet.http.HttpServletRequest request, CalendarSubscriptionRequestEntity body) Checks that a link can be subscribed to, and answers the calendar's own name.org.springframework.http.ResponseEntity<?> createSubscription(jakarta.servlet.http.HttpServletRequest request, CalendarSubscriptionRequestEntity body) Subscribes the user to a link.org.springframework.http.ResponseEntity<?> deleteSubscription(jakarta.servlet.http.HttpServletRequest request, long subscriptionId) Unsubscribes: removes the subscription, its calendar and its events.org.springframework.http.ResponseEntity<?> getSubscriptions(jakarta.servlet.http.HttpServletRequest request, Long ownerId) Lists the subscriptions of an owner: the user's own when none is named, a space's for one of its managers otherwise.org.springframework.http.ResponseEntity<?> refreshSubscription(jakarta.servlet.http.HttpServletRequest request, long subscriptionId) Refreshes a subscription now.org.springframework.http.ResponseEntity<?> updateSubscription(jakarta.servlet.http.HttpServletRequest request, long subscriptionId, CalendarSubscriptionRequestEntity body) Changes the name, the colour or the link of a subscription.
-
Constructor Details
-
AgendaCalendarSubscriptionRest
@Autowired public AgendaCalendarSubscriptionRest(org.exoplatform.agenda.service.AgendaCalendarSubscriptionService subscriptionService) Builds the resource.- Parameters:
subscriptionService- holder of every subscription rule
-
-
Method Details
-
getSubscriptions
@GetMapping("calendars/subscriptions") @Secured("users") public org.springframework.http.ResponseEntity<?> getSubscriptions(jakarta.servlet.http.HttpServletRequest request, @RequestParam(name="ownerId",required=false) Long ownerId) Lists the subscriptions of an owner: the user's own when none is named, a space's for one of its managers otherwise.- Parameters:
request- the requestownerId- identity identifier of the owner, or null for the user- Returns:
- the subscriptions
-
checkUrl
@PostMapping("calendars/subscriptions/check") @Secured("users") public org.springframework.http.ResponseEntity<Map<String,String>> checkUrl(jakarta.servlet.http.HttpServletRequest request, @RequestBody CalendarSubscriptionRequestEntity body) Checks that a link can be subscribed to, and answers the calendar's own name.- Parameters:
request- the requestbody- the link- Returns:
{"name": ...}, the name null when the calendar names none
-
createSubscription
@PostMapping("calendars/subscriptions") @Secured("users") public org.springframework.http.ResponseEntity<?> createSubscription(jakarta.servlet.http.HttpServletRequest request, @RequestBody CalendarSubscriptionRequestEntity body) Subscribes the user to a link.- Parameters:
request- the requestbody- the link, the name and the colour- Returns:
- the subscription
-
updateSubscription
@PutMapping("calendars/subscriptions/{subscriptionId}") @Secured("users") public org.springframework.http.ResponseEntity<?> updateSubscription(jakarta.servlet.http.HttpServletRequest request, @PathVariable("subscriptionId") long subscriptionId, @RequestBody CalendarSubscriptionRequestEntity body) Changes the name, the colour or the link of a subscription.- Parameters:
request- the requestsubscriptionId- technical identifier of the subscriptionbody- the fields to change, blank ones kept- Returns:
- the subscription as it now stands
-
refreshSubscription
@PostMapping("calendars/subscriptions/{subscriptionId}/refresh") @Secured("users") public org.springframework.http.ResponseEntity<?> refreshSubscription(jakarta.servlet.http.HttpServletRequest request, @PathVariable("subscriptionId") long subscriptionId) Refreshes a subscription now.- Parameters:
request- the requestsubscriptionId- technical identifier of the subscription- Returns:
- the subscription after the refresh, a failure recorded on it
-
deleteSubscription
@DeleteMapping("calendars/subscriptions/{subscriptionId}") @Secured("users") public org.springframework.http.ResponseEntity<?> deleteSubscription(jakarta.servlet.http.HttpServletRequest request, @PathVariable("subscriptionId") long subscriptionId) Unsubscribes: removes the subscription, its calendar and its events.- Parameters:
request- the requestsubscriptionId- technical identifier of the subscription- Returns:
- no content
-