org.exoplatform.webservice.cs.calendar
Class CalendarWebservice

java.lang.Object
  extended by org.exoplatform.webservice.cs.calendar.CalendarWebservice
All Implemented Interfaces:
org.exoplatform.services.rest.resource.ResourceContainer

public class CalendarWebservice
extends Object
implements org.exoplatform.services.rest.resource.ResourceContainer

The CalendarWebservice class contains services to interact with the Calendar application and its data in a RESTFull manner. These services are accessible applications inside and outside eXo Platform. For example, Gadgets and Mobile applications can use them.


Field Summary
static String BASE_EVENT_URL
           
static String BASE_RSS_URL
           
static String BASE_URL
           
static String BASE_URL_PRIVATE
           
static String BASE_URL_PUBLIC
           
static String PRIVATE
           
 
Constructor Summary
CalendarWebservice()
           
 
Method Summary
 javax.ws.rs.core.Response checkPermission(String username, String calendarId, String type)
          Checks permission of the currently logged-in user on any calendar by the given calendar Id.
 javax.ws.rs.core.Response event(String username, String eventFeedName)
          Provides details of an event with the given username and the event Id.
 javax.ws.rs.core.Response feed(String username, String feedname, String filename, javax.ws.rs.core.UriInfo uri)
          Returns the XML RSS feed data of one user's calendar.
 javax.ws.rs.core.Response getCalendars()
          Retrieves all data of a private (personal) calendar of a logged-in user.
 javax.ws.rs.core.Response getEvent(String eventid)
          Produces the content of a given private event, based on its Id.
 javax.ws.rs.core.Response getEventById(String eventid)
          Returns the details of an event identified by its Id.
 javax.ws.rs.core.Response getEvents(String type, String calids, long from, long to, long limit)
          Gets a list of personal events by their type, calendar Ids, the starting/ending time, and the maximum number of returned events.
 javax.ws.rs.core.Response getOccurrenceEvent(String eventId, String recurId)
          Produces the content of an occurrence of a repetitive event, based on its event Id and occurrence Id.
 javax.ws.rs.core.Response privateProcess(String username, String calendarId, String type)
          Generates the ICalendar data from a given calendar Id.
 javax.ws.rs.core.Response processInvitationReply(String calendarId, String calType, String eventId, String inviter, String invitee, String eXoId, String answer)
          Provides the end-point to answer or reply an invitation to join any given event by its Id.
 javax.ws.rs.core.Response publicProcess(String username, String calendarId, String type)
          Provides an end-point to subscribe a calendar of the platform.
 javax.ws.rs.core.Response upcomingEvent(String currentdatetime, String type, int limit)
          Lists upcoming events or tasks by the current date.
 javax.ws.rs.core.Response updateStatus(String taskid, int statusId)
          Allows users to update the status of a task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIVATE

public static final String PRIVATE
See Also:
Constant Field Values

BASE_URL

public static final String BASE_URL

BASE_RSS_URL

public static final String BASE_RSS_URL

BASE_EVENT_URL

public static final String BASE_EVENT_URL

BASE_URL_PUBLIC

public static final String BASE_URL_PUBLIC

BASE_URL_PRIVATE

public static final String BASE_URL_PRIVATE
Constructor Detail

CalendarWebservice

public CalendarWebservice()
Method Detail

checkPermission

@RolesAllowed(value="users")
public javax.ws.rs.core.Response checkPermission(String username,
                                                              String calendarId,
                                                              String type)
                                          throws Exception
Checks permission of the currently logged-in user on any calendar by the given calendar Id. The input parameters will be in the URL of the calendar.

Parameters:
username - The given user's Id, or the currently logged-in user.
calendarId - The given calendar Id on which the permission is checked.
type - The calendar type: _private_, _public_ or _shared_.
Returns:
The JSON data value will be returned.
Throws:
Exception

event

@RolesAllowed(value="users")
public javax.ws.rs.core.Response event(String username,
                                                    String eventFeedName)
                                throws Exception
Provides details of an event with the given username and the event Id. The returned data is in the XML format containing the details of the event, including the link to the event's ICS file.

Parameters:
username - The username of the requested user.
eventFeedName - A string which contains the event Id and the calendar type.
Returns:
The event details in the XML format, including the link to the event's ICS file.
Throws:
Exception

feed

@RolesAllowed(value="users")
public javax.ws.rs.core.Response feed(String username,
                                                   String feedname,
                                                   String filename,
                                                   @Context
                                                   javax.ws.rs.core.UriInfo uri)
                               throws Exception
Returns the XML RSS feed data of one user's calendar.

Parameters:
username - The requested username.
feedname - The name of the RSS feed.
filename - The file name.
Returns:
RSS feeds.
Throws:
Exception

publicProcess

public javax.ws.rs.core.Response publicProcess(String username,
                                               String calendarId,
                                               String type)
                                        throws Exception
Provides an end-point to subscribe a calendar of the platform.

Parameters:
username - The given Id of the user who wants to get data.
calendarId - The Id of the subscribed calendar.
type - The type of the subscribed calendar, such as _personal_, _shared_, and _public_.
Returns:
ICalendar data in text/calendar MimeType.
Throws:
Exception

privateProcess

@RolesAllowed(value="users")
public javax.ws.rs.core.Response privateProcess(String username,
                                                             String calendarId,
                                                             String type)
                                         throws Exception
Generates the ICalendar data from a given calendar Id. The data content will be all events of the calendar. This service requires authentication and permission of the _Users_ group only.

Parameters:
username - Requires the user Id for authentication and looks up the personal calendar.
calendarId - The given calendar Id to look up.
type - The calendar type, such as _private_, _shared_, _public_.
Returns:
The text/calendar MimeType (ICalendar format).
Throws:
Exception

getEvents

@RolesAllowed(value="users")
public javax.ws.rs.core.Response getEvents(String type,
                                                        String calids,
                                                        long from,
                                                        long to,
                                                        long limit)
Gets a list of personal events by their type, calendar Ids, the starting/ending time, and the maximum number of returned events. This service requires authentication and permission of the _Users_ group only.

Parameters:
type - The type of the events. The possible values are "_Event_" and "_Task_".
calids - A string of calendar Ids separated by commas (,).
from - A value of period (in miliseconds) during which the events are started.
to - A value of period (in miliseconds) during which the events are ended.
limit - The maximum number of returned events.
Returns:
Response of a JSON object. The JSON object includes the list of events saved in the "info" property.

upcomingEvent

@RolesAllowed(value="users")
public javax.ws.rs.core.Response upcomingEvent(String currentdatetime,
                                                            String type,
                                                            int limit)
                                        throws Exception
Lists upcoming events or tasks by the current date. This service requires authentication and permission of the _Users_ group only.

Parameters:
currentdatetime - The current date using the ISO 8601 format (_yyyyMMdd_).
type - The event or task.
limit - The maximum number of events returned by the current date.
Throws:
Exception - : HTTPStatus.INTERNAL_ERROR , HTTPStatus.UNAUTHORIZED , HTTPStatus.NO_CONTENT

updateStatus

@RolesAllowed(value="users")
public javax.ws.rs.core.Response updateStatus(String taskid,
                                                           int statusId)
                                       throws Exception
Allows users to update the status of a task. This service requires authentication and permission of the _Users_ group only.

Parameters:
taskid - The given task Id.
statusId - The Id of the status. The possible values are 1 - _Need action_, 2 - _In Progress_, 3 - _Completed_, and 4 - _Cancelled_.
Returns:
true/false
Throws:
Exception

getCalendars

@RolesAllowed(value="users")
public javax.ws.rs.core.Response getCalendars()
                                       throws Exception
Retrieves all data of a private (personal) calendar of a logged-in user. It requires authentication and permission of the _Users_ group only.

Returns:
The JSON object.
Throws:
Exception

getEvent

@RolesAllowed(value="users")
public javax.ws.rs.core.Response getEvent(String eventid)
                                   throws Exception
Produces the content of a given private event, based on its Id. It requires authentication and permission of the _Users_ group only.

Parameters:
eventid - The event Id.
Returns:
The JSON data type.
Throws:
Exception

getEventById

@RolesAllowed(value="users")
public javax.ws.rs.core.Response getEventById(String eventid)
                                       throws Exception
Returns the details of an event identified by its Id. It requires authentication and permission of the _Users_ group only.

Parameters:
eventid - The event Id.
Returns:
The JSON data type.
Throws:
Exception

getOccurrenceEvent

@RolesAllowed(value="users")
public javax.ws.rs.core.Response getOccurrenceEvent(String eventId,
                                                                 String recurId)
                                             throws Exception
Produces the content of an occurrence of a repetitive event, based on its event Id and occurrence Id. It requires authentication and permission of the _Users_ group only.

Parameters:
eventid - The Id of the original event.
recurid - The occurrence Id of the event.
Returns:
The JSON data type.
Throws:
Exception

processInvitationReply

public javax.ws.rs.core.Response processInvitationReply(String calendarId,
                                                        String calType,
                                                        String eventId,
                                                        String inviter,
                                                        String invitee,
                                                        String eXoId,
                                                        String answer)
                                                 throws Exception
Provides the end-point to answer or reply an invitation to join any given event by its Id.

Parameters:
calendarId - The calendar Id to which the event belongs.
calType - The calendar type, such as _public_, _private_, and _shared_.
eventId - The Id which retrieves the event data.
inviter - The Id of the invitation sender.
invitee - The Id of the receiver/participant.
eXoId - The logged-in user Id.
answer - The answer of invitation, such as _accept_, _refuse_, or _not sure_.
Returns:
The HTML response.
Throws:
Exception


Copyright © 2003–2014 eXo Platform SAS. All rights reserved.