Class RestUtils

java.lang.Object
org.exoplatform.agenda.util.RestUtils

public class RestUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    checkCalendar(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.rest.model.EventEntity eventEntity)
    Resolves the destination calendar of an event to create.
    static void
    checkCalendar(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, org.exoplatform.agenda.model.Event storedEvent)
    Resolves the destination calendar of an event and rebuilds the payload's calendar block from the stored calendar row — never from client-supplied data.
    static void
    cleanupAttachedEntitiesIds(org.exoplatform.agenda.rest.model.EventEntity eventEntity)
     
    static org.exoplatform.agenda.model.Event
    createEventEntity(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId, String timeZoneId, boolean confirmClose)
     
    static void
    fillAttendees(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, ZonedDateTime occurrenceId, Map<Long, org.exoplatform.agenda.model.EventAttendeeList> attendeesByParentEventId, long userIdentityId)
     
    static void
    fillConferences(org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, Map<Long, List<org.exoplatform.agenda.model.EventConference>> conferencesByParentEventId)
     
    static void
    fillDateOptions(org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, ZoneId userTimeZone, Map<Long, List<org.exoplatform.agenda.rest.model.EventDateOptionEntity>> dateOptionsByParentEventId)
     
    static void
    fillReminders(org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId)
     
    static void
    fillReminders(org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId, Map<Long, List<org.exoplatform.agenda.model.EventReminder>> remindersByParentEventId)
     
    static void
    fillRemoteEvent(org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId)
     
    static void
    fillRemoteEvent(org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId, Map<Long, org.exoplatform.agenda.model.RemoteEvent> remoteEventByParentEventId)
     
    static void
    fillSeatCounts(org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId)
    Fills the seats of the date an event entity shows, on a detail read: a computed date is counted on its series at that date, an event or the row of a date on its own rows, and a series read with no date at the date its answers are read at.
    static String
     
    static String
     
    static final String
     
    static final org.exoplatform.social.core.identity.model.Identity
    getCurrentUserIdentity(org.exoplatform.social.core.manager.IdentityManager identityManager)
     
    static final long
    getCurrentUserIdentityId(org.exoplatform.social.core.manager.IdentityManager identityManager)
     
    static org.exoplatform.agenda.rest.model.EventEntity
    getEventByIdAndUser(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, long eventId, boolean firstOccurrence, long identityId, ZonedDateTime occurrenceId, ZoneId userTimeZone, List<String> expandProperties)
     
    static org.exoplatform.agenda.rest.model.EventEntity
    getEventEntity(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.model.Event event, ZonedDateTime occurrenceId, ZoneId userTimeZone, List<String> expandProperties)
     
    static org.exoplatform.agenda.rest.model.EventSearchResultEntity
    getEventSearchResultEntity(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.model.EventSearchResult eventSearchResult, ZonedDateTime occurrenceId, ZoneId userTimeZone, List<String> expandProperties)
     
    static String
    getIdentityId(org.exoplatform.social.rest.entity.IdentityEntity identityEntity, org.exoplatform.social.core.manager.IdentityManager identityManager)
     
    static Integer
    getIntegerValue(javax.ws.rs.core.UriInfo uriInfo, String name)
     
    static String
    getQueryParam(javax.ws.rs.core.UriInfo uriInfo, String name)
     
    static org.exoplatform.agenda.model.RemoteEvent
    getRemoteEvent(org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId)
     
    static boolean
    isComputedOccurrence(org.exoplatform.agenda.rest.model.EventEntity eventEntity)
     
    static void
    resolveTypedAddresses(List<org.exoplatform.agenda.rest.model.EventAttendeeEntity> attendees, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaEventAttendeeService attendeeService, long callerIdentityId)
    A participant given by an e-mail address that the platform recognises, and that the client typed rather than read back from the server, is invited as the user whose address it is, never as a guest from outside the platform (eXIP 7.3.0.21, US06), when the user who saves is not an external user: an external user is told no owner, so the address stays a guest's.
    static org.exoplatform.agenda.model.Event
    splitEvent(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, long seriesId, org.exoplatform.agenda.rest.model.EventSplitEntity splitEntity, String timeZoneId, boolean confirmClose, long userIdentityId)
    Splits a recurring event as a "this and upcoming" body asks.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCurrentUser

      public static final String getCurrentUser()
    • getCurrentUserIdentity

      public static final org.exoplatform.social.core.identity.model.Identity getCurrentUserIdentity(org.exoplatform.social.core.manager.IdentityManager identityManager)
    • getCurrentUserIdentityId

      public static final long getCurrentUserIdentityId(org.exoplatform.social.core.manager.IdentityManager identityManager)
    • getBaseRestURI

      public static String getBaseRestURI()
    • getBasePortalURI

      public static String getBasePortalURI()
    • resolveTypedAddresses

      public static void resolveTypedAddresses(List<org.exoplatform.agenda.rest.model.EventAttendeeEntity> attendees, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaEventAttendeeService attendeeService, long callerIdentityId)
      A participant given by an e-mail address that the platform recognises, and that the client typed rather than read back from the server, is invited as the user whose address it is, never as a guest from outside the platform (eXIP 7.3.0.21, US06), when the user who saves is not an external user: an external user is told no owner, so the address stays a guest's. A guest already invited comes back with the id of its identity and stays one: a save never turns them into someone else. A user given twice, picked and typed, is invited once.
      Parameters:
      attendees - the participants of a write, changed in place
      identityManager - resolves the ids given
      attendeeService - resolves an address to its user
      callerIdentityId - the identity of the user who saves: an external user resolves no address
      Throws:
      IllegalStateException - when the user directory cannot be read: the write fails rather than invite a platform user as a guest
    • getIdentityId

      public static String getIdentityId(org.exoplatform.social.rest.entity.IdentityEntity identityEntity, org.exoplatform.social.core.manager.IdentityManager identityManager)
    • getIntegerValue

      public static Integer getIntegerValue(javax.ws.rs.core.UriInfo uriInfo, String name)
    • getQueryParam

      public static String getQueryParam(javax.ws.rs.core.UriInfo uriInfo, String name)
    • createEventEntity

      public static org.exoplatform.agenda.model.Event createEventEntity(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId, String timeZoneId, boolean confirmClose) throws org.exoplatform.agenda.exception.AgendaException, IllegalAccessException
      Throws:
      org.exoplatform.agenda.exception.AgendaException
      IllegalAccessException
    • splitEvent

      public static org.exoplatform.agenda.model.Event splitEvent(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, long seriesId, org.exoplatform.agenda.rest.model.EventSplitEntity splitEntity, String timeZoneId, boolean confirmClose, long userIdentityId) throws org.exoplatform.agenda.exception.AgendaException, IllegalAccessException
      Splits a recurring event as a "this and upcoming" body asks. A participant the body adds is resolved as an attendee of a new event is, an email guest's identity being created. One it removes is resolved among the attendees of the series only, by its identity's provider and remote ids, or by its identity id; a removal that matches none of them is ignored, and never creates an identity.
      Parameters:
      identityManager - IdentityManager service instance
      agendaEventService - AgendaEventService service instance
      agendaEventAttendeeService - AgendaEventAttendeeService service instance
      seriesId - the recurring event split
      splitEntity - the body
      timeZoneId - the zone the user read the series in, which the body was written in (see EventSplit.readZone()); a body without a zone is read in it and keeps the series' zone; null when unknown
      confirmClose - whether the user confirmed closing the event while people are waiting
      userIdentityId - who is splitting
      Returns:
      the continuing series
      Throws:
      org.exoplatform.agenda.exception.AgendaException - when the series does not exist, or an attendee added or the continuation is invalid
      IllegalAccessException - when the user may not split the series
    • checkCalendar

      public static void checkCalendar(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.rest.model.EventEntity eventEntity) throws org.exoplatform.agenda.exception.AgendaException
      Resolves the destination calendar of an event to create. See checkCalendar(IdentityManager, AgendaCalendarService, EventEntity, Event) for the resolution rules — this creation variant has no stored event to preserve.
      Parameters:
      identityManager - IdentityManager service instance
      agendaCalendarService - AgendaCalendarService service instance
      eventEntity - the event payload received from the client, mutated in place
      Throws:
      org.exoplatform.agenda.exception.AgendaException - when no destination calendar can be resolved
    • checkCalendar

      public static void checkCalendar(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, org.exoplatform.agenda.model.Event storedEvent) throws org.exoplatform.agenda.exception.AgendaException
      Resolves the destination calendar of an event and rebuilds the payload's calendar block from the stored calendar row — never from client-supplied data. Resolution rules, in order:
      1. an explicit calendar.id designates the stored calendar it points to, provided the payload's owner (when sent) matches that stored row's owner — this is what lets an event be filed into any of the owner's calendars instead of always the first one;
      2. an owner differing from the row designated by calendar.id means the client changed the destination owner while round-tripping the old calendar id (the historical space-change flow): the owner wins and resolves to its default calendar;
      3. on update, a payload whose owner matches the stored event's calendar owner — or that carries no destination at all — preserves the event's stored calendar instead of snapping it back to the owner's default;
      4. otherwise the owner's default calendar is lazily resolved as before.
      No ACL decision is made here: the service layer re-derives the owner from the stored calendar row and enforces permissions on it, so a forged owner block in the payload can never widen access.
      Parameters:
      identityManager - IdentityManager service instance
      agendaCalendarService - AgendaCalendarService service instance
      eventEntity - the event payload received from the client, mutated in place
      storedEvent - the currently stored event when updating, else null
      Throws:
      org.exoplatform.agenda.exception.AgendaException - when no destination calendar can be resolved
    • getEventByIdAndUser

      public static org.exoplatform.agenda.rest.model.EventEntity getEventByIdAndUser(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, long eventId, boolean firstOccurrence, long identityId, ZonedDateTime occurrenceId, ZoneId userTimeZone, List<String> expandProperties) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • getEventEntity

      public static org.exoplatform.agenda.rest.model.EventEntity getEventEntity(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.model.Event event, ZonedDateTime occurrenceId, ZoneId userTimeZone, List<String> expandProperties)
    • getEventSearchResultEntity

      public static org.exoplatform.agenda.rest.model.EventSearchResultEntity getEventSearchResultEntity(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.model.EventSearchResult eventSearchResult, ZonedDateTime occurrenceId, ZoneId userTimeZone, List<String> expandProperties)
    • fillAttendees

      public static void fillAttendees(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, ZonedDateTime occurrenceId, Map<Long, org.exoplatform.agenda.model.EventAttendeeList> attendeesByParentEventId, long userIdentityId)
    • fillSeatCounts

      public static void fillSeatCounts(org.exoplatform.agenda.service.AgendaEventAttendeeService agendaEventAttendeeService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Fills the seats of the date an event entity shows, on a detail read: a computed date is counted on its series at that date, an event or the row of a date on its own rows, and a series read with no date at the date its answers are read at. A masked event shows none.
      Parameters:
      agendaEventAttendeeService - the attendee service
      eventEntity - the entity read
      userIdentityId - the reader, whose rank on the waiting list is filled
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the event was deleted since it was read
    • fillConferences

      public static void fillConferences(org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, Map<Long, List<org.exoplatform.agenda.model.EventConference>> conferencesByParentEventId)
    • fillReminders

      public static void fillReminders(org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId, Map<Long, List<org.exoplatform.agenda.model.EventReminder>> remindersByParentEventId)
    • fillDateOptions

      public static void fillDateOptions(org.exoplatform.agenda.service.AgendaEventDatePollService agendaEventDatePollService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, ZoneId userTimeZone, Map<Long, List<org.exoplatform.agenda.rest.model.EventDateOptionEntity>> dateOptionsByParentEventId)
    • fillRemoteEvent

      public static void fillRemoteEvent(org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId)
    • fillRemoteEvent

      public static void fillRemoteEvent(org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId, Map<Long, org.exoplatform.agenda.model.RemoteEvent> remoteEventByParentEventId)
    • getRemoteEvent

      public static org.exoplatform.agenda.model.RemoteEvent getRemoteEvent(org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId)
    • fillReminders

      public static void fillReminders(org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId)
    • isComputedOccurrence

      public static boolean isComputedOccurrence(org.exoplatform.agenda.rest.model.EventEntity eventEntity)
    • cleanupAttachedEntitiesIds

      public static void cleanupAttachedEntitiesIds(org.exoplatform.agenda.rest.model.EventEntity eventEntity)