Class CalendarResource

    • Constructor Detail

      • CalendarResource

        public CalendarResource()
    • Method Detail

      • getCalendars

        @GET
        @Produces("application/json")
        public List<CalendarEntity> getCalendars()
        Gets the JSON representation of a list of calendar. If it doesn't exist, a 404 HTTP code is returned.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked calendars.
        See Also:
        RESTWebService.WebProcess.execute()
      • getCalendar

        @GET
        @Path("{calendarId}")
        @Produces("application/json")
        public CalendarEntity getCalendar​(@PathParam("calendarId")
                                          String calendarId)
        Gets the JSON representation of a calendar represented by the given identifier. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        calendarId - the identifier of the aimed calendar
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked calendar.
        See Also:
        RESTWebService.WebProcess.execute()
      • createCalendar

        @POST
        @Produces("application/json")
        public CalendarEntity createCalendar​(CalendarEntity calendarEntity)
        Creates the calendar from its JSON representation and returns it once created.
        If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to save the calendar, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        calendarEntity - the calendar data
        Returns:
        the response to the HTTP POST request with the JSON representation of the created calendar.
      • updateCalendar

        @PUT
        @Path("{calendarId}")
        @Produces("application/json")
        public CalendarEntity updateCalendar​(@PathParam("calendarId")
                                             String calendarId,
                                             CalendarEntity calendarEntity)
        Updates the calendar from its JSON representation and returns it once updated. If the calendar to update doesn't match with the requested one, a 400 HTTP code is returned. If the calendar doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to save the calendar, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        calendarId - the identifier of the updated calendar
        calendarEntity - the data of the calendar
        Returns:
        the response to the HTTP PUT request with the JSON representation of the updated calendar.
      • deleteCalendar

        @DELETE
        @Path("{calendarId}")
        @Produces("application/json")
        public void deleteCalendar​(@PathParam("calendarId")
                                   String calendarId)
        Deletes the calendar from its JSON identifier. If the calendar doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to save the calendar, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        calendarId - the identifier of the deleted calendar
      • exportCalendarAsICalendarFormat

        @GET
        @Path("{calendarId}/export/ical")
        @Produces("text/calendar")
        public javax.ws.rs.core.Response exportCalendarAsICalendarFormat​(@PathParam("calendarId")
                                                                         String calendarId)
        Gets the JSON representation of a calendar represented by the given identifier. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        calendarId - the identifier of the aimed calendar
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked calendar.
        See Also:
        RESTWebService.WebProcess.execute()
      • importEventsAsICalendarFormat

        @POST
        @Path("{calendarId}/import/ical")
        @Produces("application/json")
        public javax.ws.rs.core.Response importEventsAsICalendarFormat​(@PathParam("calendarId")
                                                                       String calendarId)
        Permits to import one iCalendar file from http request. The file upload is performed by FileUploadResource mechanism.
        This service is awaiting the upload parameters handled by silverpeas-fileUpload.js plugin.
        (see FileUploadManager) in order to get more information. If the user isn't authenticated, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      • synchronizeCalendar

        @PUT
        @Path("{calendarId}/synchronization")
        @Produces("application/json")
        public javax.ws.rs.core.Response synchronizeCalendar​(@PathParam("calendarId")
                                                             String calendarId)
        Permits to synchronize manually a calendar for which an external url is set. If the user isn't authenticated, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      • getNextEventOccurrences

        @GET
        @Path("events/occurrences/next")
        @Produces("application/json")
        public List<CalendarEventOccurrenceEntity> getNextEventOccurrences​(@QueryParam("limit")
                                                                           Integer limit)
        Gets the JSON representation of a list of calendar event occurrence. If it doesn't exist, a 404 HTTP code is returned.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked occurrences.
        See Also:
        RESTWebService.WebProcess.execute()
      • getAllEventOccurrencesFrom

        @GET
        @Path("events/occurrences")
        @Produces("application/json")
        public List<ParticipantCalendarEventOccurrencesEntity> getAllEventOccurrencesFrom()
        Gets the JSON representation of a list of calendar event occurrence. If it doesn't exist, a 404 HTTP code is returned.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked occurrences.
        See Also:
        RESTWebService.WebProcess.execute()
      • getEventOccurrencesOf

        @GET
        @Path("{calendarId}/events/occurrences")
        @Produces("application/json")
        public List<CalendarEventOccurrenceEntity> getEventOccurrencesOf​(@PathParam("calendarId")
                                                                         String calendarId)
        Gets the JSON representation of a list of calendar event occurrence. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        calendarId - the identifier of calendar the occurrences must belong with
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked occurrences.
        See Also:
        RESTWebService.WebProcess.execute()
      • getEventOccurrencesOf

        @GET
        @Path("{calendarId}/events/{eventId}/occurrences")
        @Produces("application/json")
        public List<CalendarEventOccurrenceEntity> getEventOccurrencesOf​(@PathParam("calendarId")
                                                                         String calendarId,
                                                                         @PathParam("eventId")
                                                                         String eventId)
        Gets the JSON representation of a list of calendar event occurrence of an aimed event. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        calendarId - the identifier of calendar the event must belong with
        eventId - the identifier of event the returned occurrences must be linked with
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked occurrences.
        See Also:
        RESTWebService.WebProcess.execute()
      • getEvent

        @GET
        @Path("{calendarId}/events/{eventId}")
        @Produces("application/json")
        public CalendarEventEntity getEvent​(@PathParam("calendarId")
                                            String calendarId,
                                            @PathParam("eventId")
                                            String eventId)
        Gets the JSON representation of a calendar eventof an aimed event. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        calendarId - the identifier of calendar the event must belong with.
        eventId - the identifier of the aimed event.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked event.
        See Also:
        RESTWebService.WebProcess.execute()
      • createEvent

        @POST
        @Path("{calendarId}/events")
        @Produces("application/json")
        public CalendarEventEntity createEvent​(@PathParam("calendarId")
                                               String calendarId,
                                               CalendarEventEntity eventEntity)
        Creates a calendar event from the JSON representation of an occurrence and returns the created event.
        If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to save the calendar, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        calendarId - the identifier of calendar the event must belong with
        eventEntity - the calendar event data
        Returns:
        the response to the HTTP POST request with the JSON representation of the created calendar event.
      • getEventOccurrence

        @GET
        @Path("{calendarId}/events/{eventId}/occurrences/{occurrenceId}")
        @Produces("application/json")
        public CalendarEventOccurrenceEntity getEventOccurrence​(@PathParam("calendarId")
                                                                String calendarId,
                                                                @PathParam("eventId")
                                                                String eventId,
                                                                @PathParam("occurrenceId")
                                                                String occurrenceId)
        Gets the JSON representation of a calendar event occurrence of an aimed event. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        calendarId - the identifier of calendar the event must belong with.
        eventId - the identifier of event the returned occurrence must be linked with.
        occurrenceId - the identifier of the aimed occurrence.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked occurrence.
        See Also:
        RESTWebService.WebProcess.execute()
      • updateEventOccurrence

        @PUT
        @Path("{calendarId}/events/{eventId}/occurrences/{occurrenceId}")
        @Produces("application/json")
        public List<CalendarEventEntity> updateEventOccurrence​(@PathParam("calendarId")
                                                               String calendarId,
                                                               @PathParam("eventId")
                                                               String eventId,
                                                               @PathParam("occurrenceId")
                                                               String occurrenceId,
                                                               CalendarEventOccurrenceUpdateEntity occurrenceEntity)
        Updates a occurrence from its JSON representation and returns the list of updated and created events.
        If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to save the calendar, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        calendarId - the identifier of calendar the event must belong with.
        eventId - the identifier of updated event.
        occurrenceId - the identifier of the aimed occurrence.
        occurrenceEntity - the calendar event data given threw an occurrence structure
        Returns:
        the response to the HTTP POST request with the JSON representation of the updated/created events.
      • deleteEventOccurrence

        @DELETE
        @Path("{calendarId}/events/{eventId}/occurrences/{occurrenceId}")
        @Produces("application/json")
        public CalendarEventEntity deleteEventOccurrence​(@PathParam("calendarId")
                                                         String calendarId,
                                                         @PathParam("eventId")
                                                         String eventId,
                                                         @PathParam("occurrenceId")
                                                         String occurrenceId,
                                                         CalendarEventOccurrenceDeleteEntity occurrenceEntity)
        Deletes an event from the JSON representation of an occurrence and returns an updated event if any.
        If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to save the calendar, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        calendarId - the identifier of calendar the event must belong with.
        eventId - the identifier of deleted event.
        occurrenceId - the identifier of the aimed occurrence.
        occurrenceEntity - the calendar event data given threw an occurrence structure
        Returns:
        the response to the HTTP POST request with the JSON representation of an updated event if any.
      • updateEventAttendeeParticipation

        @PUT
        @Path("{calendarId}/events/{eventId}/occurrences/{occurrenceId}/attendees/{attendeeId}")
        @Produces("application/json")
        public CalendarEventEntity updateEventAttendeeParticipation​(@PathParam("calendarId")
                                                                    String calendarId,
                                                                    @PathParam("eventId")
                                                                    String eventId,
                                                                    @PathParam("occurrenceId")
                                                                    String occurrenceId,
                                                                    @PathParam("attendeeId")
                                                                    String attendeeId,
                                                                    CalendarEventAttendeeAnswerEntity answerEntity)
        Updates the participation status of an attendee about an event.
        If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to save the calendar, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        calendarId - the identifier of calendar the event must belong with
        eventId - the identifier of event
        attendeeId - the identifier of the attendee belonging the event
        answerEntity - the new participation status with all needed data to save it.
        Returns:
        the response to the HTTP POST request with the JSON representation of the updated/created events.
      • asWebEntities

        public List<CalendarEntity> asWebEntities​(Collection<Calendar> calendars)
        Converts the list of calendar into list of calendar web entities.
        Parameters:
        calendars - the calendars to convert.
        Returns:
        the calendar web entities.
      • asWebEntity

        public CalendarEntity asWebEntity​(Calendar calendar)
        Converts the calendar into its corresponding web entity. If the specified calendar isn't defined, then an HTTP 404 error is sent back instead of the entity representation of the calendar.
        Parameters:
        calendar - the calendar to convert.
        Returns:
        the corresponding calendar entity.
      • asEventWebEntities

        public List<CalendarEventEntity> asEventWebEntities​(Collection<CalendarEvent> events)
        Converts the list of calendar event into list of calendar event web entities.
        Parameters:
        events - the calendar events to convert.
        Returns:
        the calendar event web entities.
      • asEventWebEntity

        public CalendarEventEntity asEventWebEntity​(CalendarEvent event)
        Converts the calendar event into its corresponding web entity. If the specified calendar event isn't defined, then an HTTP 404 error is sent back instead of the entity representation of the calendar event.
        Parameters:
        event - the calendar event to convert.
        Returns:
        the corresponding calendar event entity.
      • asOccurrenceWebEntities

        public List<CalendarEventOccurrenceEntity> asOccurrenceWebEntities​(Collection<CalendarEventOccurrence> occurrences)
        Converts the list of calendar event occurrence into list of calendar event occurrence web entities.
        Parameters:
        occurrences - the calendar event occurrences to convert.
        Returns:
        the calendar event occurrence web entities.
      • asOccurrenceWebEntity

        public CalendarEventOccurrenceEntity asOccurrenceWebEntity​(CalendarEventOccurrence occurrence)
        Converts the calendar event occurrence into its corresponding web entity. If the specified calendar event occurrence isn't defined, then an HTTP 404 error is sent back instead of the entity representation of the calendar event occurrence.
        Parameters:
        occurrence - the calendar event occurrence to convert.
        Returns:
        the corresponding calendar event occurrence entity.
      • asAttendeeWebEntity

        public CalendarEventAttendeeEntity asAttendeeWebEntity​(CalendarEventOccurrence occurrence,
                                                               Attendee attendee)
        Converts the calendar event attendee into its corresponding web entity. If the specified calendar event attendee isn't defined, then an HTTP 404 error is sent back instead of the entity representation of the calendar event occurrence.
        Parameters:
        occurrence - the occurrence the attendees belongs to.
        attendee - the calendar event attendee to convert.
        Returns:
        the corresponding calendar event attendee entity.
      • asAttributeWebEntity

        public CalendarEventAttributeEntity asAttributeWebEntity​(Map.Entry<String,​String> nameAndValue)
        Converts the calendar event attribute into its corresponding web entity.
        Parameters:
        nameAndValue - the data which represents an attribute.
        Returns:
        the corresponding calendar event attribute entity.
      • getBundleLocation

        protected String getBundleLocation()
        Description copied from class: RESTWebService
        Gets the location of the bundle to use.
        Overrides:
        getBundleLocation in class RESTWebService
        Returns:
        the classpath location of the localization bundle used by this Web service.