Package org.exoplatform.agenda.util
Class RestUtils
java.lang.Object
org.exoplatform.agenda.util.RestUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckCalendar(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 voidcheckCalendar(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 voidcleanupAttachedEntitiesIds(org.exoplatform.agenda.rest.model.EventEntity eventEntity) static org.exoplatform.agenda.model.EventcreateEventEntity(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.agenda.service.AgendaCalendarService agendaCalendarService, org.exoplatform.agenda.service.AgendaEventService agendaEventService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId, String timeZoneId) static voidfillAttendees(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 voidfillConferences(org.exoplatform.agenda.service.AgendaEventConferenceService agendaEventConferenceService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, Map<Long, List<org.exoplatform.agenda.model.EventConference>> conferencesByParentEventId) static voidfillDateOptions(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 voidfillReminders(org.exoplatform.agenda.service.AgendaEventReminderService agendaEventReminderService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId) static voidfillReminders(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 voidfillRemoteEvent(org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId) static voidfillRemoteEvent(org.exoplatform.agenda.service.AgendaRemoteEventService agendaRemoteEventService, org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId, Map<Long, org.exoplatform.agenda.model.RemoteEvent> remoteEventByParentEventId) static Stringstatic Stringstatic final Stringstatic final org.exoplatform.social.core.identity.model.IdentitygetCurrentUserIdentity(org.exoplatform.social.core.manager.IdentityManager identityManager) static final longgetCurrentUserIdentityId(org.exoplatform.social.core.manager.IdentityManager identityManager) static org.exoplatform.agenda.rest.model.EventEntitygetEventByIdAndUser(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.EventEntitygetEventEntity(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.EventSearchResultEntitygetEventSearchResultEntity(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 StringgetIdentityId(org.exoplatform.social.rest.entity.IdentityEntity identityEntity, org.exoplatform.social.core.manager.IdentityManager identityManager) static IntegergetIntegerValue(javax.ws.rs.core.UriInfo uriInfo, String name) static StringgetQueryParam(javax.ws.rs.core.UriInfo uriInfo, String name) static org.exoplatform.agenda.model.RemoteEventgetRemoteEvent(org.exoplatform.agenda.rest.model.EventEntity eventEntity, long userIdentityId) static booleanisComputedOccurrence(org.exoplatform.agenda.rest.model.EventEntity eventEntity)
-
Method Details
-
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
-
getBasePortalURI
-
getIdentityId
public static String getIdentityId(org.exoplatform.social.rest.entity.IdentityEntity identityEntity, org.exoplatform.social.core.manager.IdentityManager identityManager) -
getIntegerValue
-
getQueryParam
-
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.rest.model.EventEntity eventEntity, long userIdentityId, String timeZoneId) throws org.exoplatform.agenda.exception.AgendaException, IllegalAccessException - Throws:
org.exoplatform.agenda.exception.AgendaExceptionIllegalAccessException
-
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. SeecheckCalendar(IdentityManager, AgendaCalendarService, EventEntity, Event)for the resolution rules — this creation variant has no stored event to preserve.- Parameters:
identityManager-IdentityManagerservice instanceagendaCalendarService-AgendaCalendarServiceservice instanceeventEntity- 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:- an explicit
calendar.iddesignates 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; - an owner differing from the row designated by
calendar.idmeans 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; - 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;
- otherwise the owner's default calendar is lazily resolved as before.
- Parameters:
identityManager-IdentityManagerservice instanceagendaCalendarService-AgendaCalendarServiceservice instanceeventEntity- the event payload received from the client, mutated in placestoredEvent- the currently stored event when updating, elsenull- Throws:
org.exoplatform.agenda.exception.AgendaException- when no destination calendar can be resolved
- an explicit
-
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) -
fillConferences
-
fillReminders
-
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
-
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)
-