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

Calendar web service is the implementation of RESTFul service to provide information to all needed request from calendar application system or out side, such as some gadgets or other request to interact with calendar application data


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)
          Check permission of the currently logged user on any calendar by the given calendar Id.
 javax.ws.rs.core.Response event(String username, String eventFeedName)
          Provide details of an event with the given username and event Id.
 javax.ws.rs.core.Response feed(String username, String feedname, String filename, javax.ws.rs.core.UriInfo uri)
          Return the XML RSS feed data of one user's calendar.
 javax.ws.rs.core.Response getCalendars()
          Retrieve all data of a private (personal) calendar of a logged-in user.
 javax.ws.rs.core.Response getEvent(String eventid)
          Produce the content of a given private event basing on its Id.
 javax.ws.rs.core.Response getEventById(String eventid)
          Produce the content of a given event basing on its Id.
 javax.ws.rs.core.Response getEvents(String type, String calids, long from, long to, long limit)
          Get a list of personal events by their type, a list of calendar Ids, from time, to time and the size limitation.
 javax.ws.rs.core.Response privateProcess(String username, String calendarId, String type)
          Generate 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)
          Provide 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)
          Provide an end-point to subscribe calendars from the Calendar function of eXo Platform.
 javax.ws.rs.core.Response upcomingEvent(String currentdatetime, String type, int limit)
          List upcoming events or tasks by the current date.
 javax.ws.rs.core.Response updateStatus(String taskid, int statusId)
          Allow 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
Check permission of the currently logged 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 user.
calendarId - The given calendar Id on which the permission is checked.
type - The calendar type: _private_, _public_ or _shared_.
Returns:
JSon data value will return
Throws:
Exception

event

@RolesAllowed(value="users")
public javax.ws.rs.core.Response event(String username,
                                                    String eventFeedName)
                                throws Exception
Provide details of an event with the given username and event Id. The data returned will be in the _ics_ format.

Parameters:
username - The requested username.
eventFeedName - Contain _eventId_ and _CalType_.
Returns:
: RSS feeds in the _XML_ format.
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
Return 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
Provide an end-point to subscribe calendars from the Calendar function of eXo Platform.

Parameters:
username - The given Id of the user who wants to get data.
calendarId - The given calendar Id.
type - The calendar type, 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
Generate the ICalendar data from a given calendar Id. The data content will be all events inside. This service requires authentication and permission of the _Users_ group only.

Parameters:
username - Require the user Id for authentication and look up the personal calendar.
calendarId - The given calendar Id to look up.
type - The calendar type, such as _private_, _shared_, _public_.
Returns:
: 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)
Get a list of personal events by their type, a list of calendar Ids, from time, to time and the size limitation. 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 "info" property.

upcomingEvent

@RolesAllowed(value="users")
public javax.ws.rs.core.Response upcomingEvent(String currentdatetime,
                                                            String type,
                                                            int limit)
                                        throws Exception
List 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
Allow 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. Possible values are 1 - _Need action_, 2 - _In Progress_, 3 - _Completed_, and 4 - _Canceled_.
Returns:
true/false
Throws:
Exception

getCalendars

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

Returns:
: json object
Throws:
Exception

getEvent

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

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

getEventById

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

Parameters:
eventid - The event Id.
Returns:
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
Provide 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 user Id of the inviter (owner of invitation).
invitee - The user Id of the receiver/participant.
eXoId - The user Id when being logged in.
answer - The answer of invitation, such as _accept_, _refuse_, or _will join_.
Returns:
will be HTML in response
Throws:
Exception


Copyright © 2013 eXo Platform SAS. All Rights Reserved.