Class AgendaEventMcpTool

java.lang.Object
org.exoplatform.agenda.mcp.AgendaEventMcpTool
All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin

@Service @Profile("mcp-server") public class AgendaEventMcpTool extends Object implements io.meeds.mcp.server.plugin.McpToolPlugin
  • Constructor Details

    • AgendaEventMcpTool

      @Autowired public AgendaEventMcpTool(org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaAvailabilityService agendaAvailabilityService, org.exoplatform.agenda.service.AgendaScheduleConflictService agendaScheduleConflictService, org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.service.AgendaUserSettingsService agendaUserSettingsService, org.exoplatform.portal.config.UserPortalConfigService portalConfigService, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, io.meeds.portal.permlink.service.PermanentLinkService permanentLinkService, io.meeds.social.translation.service.TranslationService translationService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.portal.config.UserACL userAcl)
  • Method Details

    • getAgendaEvents

      public AgendaEventCollectionModel getAgendaEvents(String start, String end, Long spaceId, Integer limit) throws IllegalAccessException
      Lists the current user's events from a start date, up to an end date or a limit. With a spaceId, only the events of that space's calendar are listed, and none when the space is missing or the user can't view it.
      Parameters:
      start - the window start, now when blank
      end - the window end, or blank to use the limit
      spaceId - the space to restrict to, or null or 0 for none
      limit - the maximum number of events
      Returns:
      the events of the window
      Throws:
      IllegalAccessException - when the user may not read the events
    • getAgendaEventById

      public AgendaEventModel getAgendaEventById(long eventId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • createAgendaEvent

      public AgendaEventModel createAgendaEvent(Long spaceId, String summary, String description, String location, String start, String end, List<String> attendeeUsernames, String recurrenceFrequency, Integer recurrenceInterval, String recurrenceUntil, Integer recurrenceCount, Boolean failOnConflict, String space) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.agenda.exception.AgendaException
      Creates an agenda event, optionally recurrent, with a server-side conflict report over its attendees. When failOnConflict is true and at least one attendee is busy or tentative in the window, creation is aborted.

      The event goes to the space calendar that spaceId or space names, which requires the right to write in that space; with neither, it goes to the caller's own personal calendar.

      Parameters:
      spaceId - the space whose calendar receives the event, or null
      summary - the event's title
      description - the event's description
      location - the event's location
      start - the start date-time (ISO)
      end - the end date-time (ISO)
      attendeeUsernames - the attendees' usernames
      recurrenceFrequency - the recurrence frequency, or null for a single event
      recurrenceInterval - the recurrence interval
      recurrenceUntil - the recurrence end date
      recurrenceCount - the number of occurrences
      failOnConflict - whether an attendee's conflict aborts the creation
      space - the name of the space whose calendar receives the event, or null
      Returns:
      the created event, with its conflict report unless the call is limited to a space
      Throws:
      IllegalAccessException - when the caller may not write in the named space
      org.exoplatform.commons.exception.ObjectNotFoundException - when the named space does not exist
      org.exoplatform.agenda.exception.AgendaException - when the event is invalid
    • declineAgendaEventInvitation

      public void declineAgendaEventInvitation(Long eventId, String occurrenceId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • cancelAgendaEvent

      public void cancelAgendaEvent(Long eventId, String occurrenceId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.agenda.exception.AgendaException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
      org.exoplatform.agenda.exception.AgendaException
    • acceptAgendaEventInvitation

      public AgendaEventModel acceptAgendaEventInvitation(Long eventId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Answers Yes to an event as the current user, and reads the event back, as respondToAgendaEvent(Long, String, String) does: on a date whose seats are all taken, the Yes joins the waiting list, which the answer read back says.
      Parameters:
      eventId - the event's identifier
      Returns:
      the event as the user now reads it
      Throws:
      IllegalAccessException - when the user may not access the event, or may not answer it: not invited, and the event isn't open to them
      org.exoplatform.commons.exception.ObjectNotFoundException - when the event does not exist
    • inviteUsersToAgendaEvent

      public AgendaEventModel inviteUsersToAgendaEvent(Long eventId, List<String> attendeeUsernames) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Invites users to an event the current user can edit, and sends the invitation to the newly invited ones only; users already invited are neither added again nor notified again. In a call limited to a space, every invited user must be a member of that space.
      Parameters:
      eventId - the event
      attendeeUsernames - the logins to invite
      Returns:
      the event
      Throws:
      IllegalAccessException - when the current user can't edit the event, or, in a call limited to a space, a user isn't a member of it or the call's space can't be read
      org.exoplatform.commons.exception.ObjectNotFoundException - when the event doesn't exist
    • inviteSpaceToAgendaEvent

      public AgendaEventModel inviteSpaceToAgendaEvent(Long eventId, Long spaceId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Invites a space the current user can access to an event the current user can edit, and sends the invitation to its members; a space already invited is neither added again nor notified again. In a call limited to a space, only that space can be invited.
      Parameters:
      eventId - the event
      spaceId - the space to invite
      Returns:
      the event
      Throws:
      IllegalAccessException - when the current user can't edit the event or access the space, or, in a call limited to a space, the space is another one or the call's space can't be read
      org.exoplatform.commons.exception.ObjectNotFoundException - when the event doesn't exist
    • updateAgendaEvent

      public AgendaEventModel updateAgendaEvent(Long eventId, String summary, String description, String location, String start, String end, String recurrenceFrequency, Integer recurrenceInterval, String recurrenceUntil, Integer recurrenceCount, Boolean failOnConflict) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.agenda.exception.AgendaException
      Updates an agenda event: only the provided fields change, and its recurrence may be set again. It reports the attendees' busy times in the event's window, unless the call is limited to a space: the report reads the attendees' own agendas, beyond the space. When fail_on_conflict is true and an attendee is busy or tentative in the window, the update is aborted; a call limited to a space can't ask for that.
      Parameters:
      eventId - the event
      summary - its new title, unchanged when blank
      description - its new description, unchanged when null
      location - its new location, unchanged when null
      start - its new start, unchanged when blank
      end - its new end, unchanged when blank
      recurrenceFrequency - its recurrence frequency, none to keep it
      recurrenceInterval - its recurrence interval
      recurrenceUntil - the end of its recurrence
      recurrenceCount - its number of occurrences
      failOnConflict - true to abort the update when an attendee is busy
      Returns:
      the updated event, with its conflicts report unless the call is limited to a space
      Throws:
      IllegalAccessException - when the current user can't edit the event
      org.exoplatform.commons.exception.ObjectNotFoundException - when the event doesn't exist
      org.exoplatform.agenda.exception.AgendaException - when the event can't be saved
    • deleteAgendaEvent

      public void deleteAgendaEvent(Long eventId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • createDatePoll

      public DatePollModel createDatePoll(Long spaceId, String title, List<String> proposedSlots, List<String> attendeeUsernames, String description, Boolean rankSlotsByAvailability, String space) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.agenda.exception.AgendaException
      Create a date poll: a TENTATIVE event carrying several proposed slots that attendees can vote on. Each proposed slot is a "<startRFC3339>|<endRFC3339>" string. When rank_slots_by_availability is true, slots are ordered so the ones with the most available internal attendees come first. Every poll must belong to a space: pass either space_id or a space name via the 'space' parameter (resolved to resolvedSpaceId).
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
      org.exoplatform.agenda.exception.AgendaException
    • voteDatePoll

      public DatePollModel voteDatePoll(Long eventId, List<Long> acceptedSlotIds) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • getDatePollResults

      public DatePollModel getDatePollResults(long eventId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • confirmDatePoll

      public AgendaEventModel confirmDatePoll(Long dateOptionId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Confirms a date poll on one of its proposed dates, which turns it into a confirmed event on that date, and reports the attendees' busy times in that window. In a call limited to a space, the report is left out: it reads the attendees' own agendas, beyond the space.
      Parameters:
      dateOptionId - the chosen date option
      Returns:
      the confirmed event, with its conflicts report unless the call is limited to a space
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the date option doesn't exist
      IllegalAccessException - when the current user can't edit the event
    • getScopeSpaceId

      protected Long getScopeSpaceId()
      Returns:
      the space the current call is limited to, null when it isn't
      Throws:
      IllegalStateException - when the call's identity can't be read
    • isSpaceScoped

      protected boolean isSpaceScoped()
      Returns:
      true when the current call is limited to a space; also true when its identity can't be read, which a limited call must never be taken for the opposite of
    • getAvailability

      public List<AvailabilityModel> getAvailability(List<String> usernames, String start, String end, Long spaceId) throws IllegalAccessException
      Returns each named user's busy and free time blocks over a window.

      Glue only: usernames and RFC3339 bounds are resolved here, the ACL, the sharing setting and the free/busy algebra all belong to AgendaAvailabilityService. Asking about a user who does not disclose their busy time to the caller is refused, not silently omitted: an omitted user would read as one with nothing in their calendar. With a space, every user must be one of its members (checkSpaceMembers(Long, List)).

      Parameters:
      usernames - the users to report on
      start - window start, RFC3339
      end - window end, RFC3339
      spaceId - the space whose members the users must all be, null for none; a call limited to a space always has that space
      Returns:
      one entry per username that resolved to an identity
      Throws:
      IllegalAccessException - when the caller may not read one of them, one of them isn't a member of the space, the caller can't reach the space, or the call is limited to another space or its identity can't be read
      IllegalArgumentException - when a mandatory argument is missing or invalid, or the space doesn't exist
    • suggestMeetingTime

      public List<TimeBlockModel> suggestMeetingTime(List<String> attendees, Integer durationMinutes, String windowStart, String windowEnd, String constraints, Long spaceId) throws IllegalAccessException
      Suggests candidate slots of at least duration_minutes over which every attendee is free.

      Glue only. Note that this refuses outright when one attendee's availability is not disclosed to the caller — whether because the calendar ACL says so or because that attendee shares their busy time more narrowly: a suggestion computed from a subset of the attendees would read as a whole answer.

      Parameters:
      attendees - the users who must all be free
      durationMinutes - the wanted slot length, in minutes
      windowStart - earliest acceptable start, RFC3339
      windowEnd - latest acceptable end, RFC3339
      constraints - optional free text; "mornings" and "afternoons" are honoured
      spaceId - the space whose members the attendees must all be, null for none; a call limited to a space always has that space
      Returns:
      the candidate slots, earliest first
      Throws:
      IllegalAccessException - when the caller may not read one of them, one of them isn't a member of the space, the caller can't reach the space, or the call is limited to another space or its identity can't be read
      IllegalArgumentException - when a mandatory argument is missing or invalid, or the space doesn't exist
    • getEventAttendees

      public List<AgendaEventAttendeeModel> getEventAttendees(long eventId) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • respondToAgendaEvent

      public AgendaEventModel respondToAgendaEvent(Long eventId, String response, String comment) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • setEventReminders

      public List<String> setEventReminders(Long eventId, List<String> reminders) throws IllegalAccessException, org.exoplatform.agenda.exception.AgendaException
      Throws:
      IllegalAccessException
      org.exoplatform.agenda.exception.AgendaException
    • getEventConference

      public ConferenceModel getEventConference(long eventId) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • setEventConference

      public ConferenceModel setEventConference(Long eventId, String url, String type) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • searchAgendaEvents

      public List<AgendaEventModel> searchAgendaEvents(String query, String start, String end, Long spaceId)
      Keyword search over the agenda events the current user can access, optionally restricted to a space. The search index has no date-range filter, so start and end are applied as a post-filter here. With a spaceId, only the events of that space's own calendar are kept: the index matches an event that merely invites the space too, and that one belongs to the owner of its calendar. None when the space is missing or the user can't view it.
      Parameters:
      query - the keywords, mandatory
      start - the window start, or blank for none
      end - the window end, or blank for none
      spaceId - the space to restrict to, or null or 0 for none
      Returns:
      the matching events
    • getScheduleConflicts

      public ScheduleConflictsModel getScheduleConflicts(String start, String end) throws IllegalAccessException
      Throws:
      IllegalAccessException