public class

GoogleCalendarConnector

extends AbstractGoogleOAuthConnector
java.lang.Object
   ↳ org.mule.modules.google.AbstractGoogleOAuthConnector
     ↳ org.mule.module.google.calendar.GoogleCalendarConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Google Calendars Cloud connector. This connector covers almost all the Google Calendar API v3 using OAuth2 for authentication.

Summary

[Expand]
Inherited Constants
From class org.mule.modules.google.AbstractGoogleOAuthConnector
Fields
private String accessToken
private String applicationName Application name registered on Google API console
private Calendar client The google api client
private GoogleCalendarClientFactory clientFactory Factory to instantiate the underlying google client.
private String consumerKey The OAuth2 consumer key
private String consumerSecret The OAuth2 consumer secret
private String scope The OAuth scopes you want to request
[Expand]
Inherited Fields
From class org.mule.modules.google.AbstractGoogleOAuthConnector
Public Constructors
GoogleCalendarConnector()
Public Methods
void batchDeleteCalendar(Collection<Calendar> calendars)
Deletes many events in a batch
void batchDeleteEvent(String calendarId, Collection<Event> calendarEvents)
Deletes many events in a batch
BatchResponse<Calendar> batchInsertCalendar(Collection<Calendar> calendars)
Inserts many calendars in a batch
BatchResponse<Event> batchInsertEvent(String calendarId, Collection<Event> calendarEvents)
Inserts many events as a batch
BatchResponse<Calendar> batchUpdateCalendar(Collection<Calendar> calendars)
Updates many calendars in a batch
BatchResponse<Event> batchUpdateEvent(String calendarId, Collection<Event> calendarEvents)
Updates many events in a batch
void clearCalendar(String id)
Clears all the events on the calendar referenced by id
Calendar createCalendar(Calendar calendar)
Inserts a new calendar associated with the user that owns the current OAuth token
void deleteAclRule(String calendarId, String ruleId)
Deletes an ACL rule on a calendar
void deleteCalendar(String id)
Deletes a particular calendar referenced by id
void deleteCalendarList(String id)
Deletes a calendar list referenced by id
void deleteEvent(String calendarId, String eventId)
Deletes an event from a specified calendar
String getAccessToken()
AclRule getAclRuleById(String calendarId, String ruleId)
Retrieves a Rule by Id
List<AclRule> getAllAclRules(String calendarId)
Returns all the Acl rules for a particular calendar
String getApplicationName()
Calendar getCalendarById(String id)
Returns a particular calendar specified by id
ProviderAwarePagingDelegate<CalendarList, AbstractGoogleOAuthConnector> getCalendarList(boolean showHidden, PagingConfiguration pagingConfiguration)
Returns a paginated iterator with instances of CalendarList listing the calendars of the user that owns the OAuth access token.
CalendarList getCalendarListById(String id)
Returns a particular calendar list identified by id.
Object getClient()
GoogleCalendarClientFactory getClientFactory()
String getConsumerKey()
String getConsumerSecret()
Event getEventById(String calendarId, String eventId)
Retrieves an event by id
ProviderAwarePagingDelegate<Event, AbstractGoogleOAuthConnector> getEvents(String calendarId, String icalUID, Integer maxAttendees, String orderBy, String query, boolean showDeleted, boolean showHiddenInvitations, boolean singleEvents, String timeMin, String timeMax, String datetimeFormat, String timezone, String lastUpdated, PagingConfiguration pagingConfiguration)
Searchs and returns events matching the criteria parameters.
FreeBusy getFreeTime(String timeMin, String timeMax, List<String> ids, String timezone, String datetimeFormat, Integer maxCalendarExpansion)
Returns the free time the authenticated user has between two times
ProviderAwarePagingDelegate<Event, AbstractGoogleOAuthConnector> getInstances(String calendarId, String eventId, Integer maxAttendess, boolean showDeleted, String timezone, String originalStart, PagingConfiguration pagingConfiguration)
For recurring events, it returns one instance of Event for each recurrence instance
String getScope()
Event importEvent(String calendarId, Event calendarEvent)
Imports the given event into a calendar
void init()
Initializes the connector.
AclRule insertAclRule(String calendarId, String scope, ScopeType scopeType, ScopeRole role)
Inserts a new ACL rule in a calendar
Event insertEvent(String calendarId, Event calendarEvent)
Inserts the given event into an specified calendar
Event moveEvent(String sourceCalendarId, String eventId, String targetCalendarId)
Moves a calendar form one calendar to another
void postAuth()
Event quickAddEvent(String calendarId, String text)
Shortcut method for creating an event with nothing but a description text.
void setAccessToken(String accessToken)
void setApplicationName(String applicationName)
void setClientFactory(GoogleCalendarClientFactory clientFactory)
void setConsumerKey(String consumerKey)
void setConsumerSecret(String consumerSecret)
void setScope(String scope)
AclRule updateAclRule(String calendarId, String ruleId, AclRule aclRule)
Updates a rule on a given calendar
Calendar updateCalendar(String id, Calendar calendar)
Updates a calendar referenced by id with the content of one specified or taken from the message payload.
CalendarList updateCalendarList(String id, CalendarList calendarList)
Updates a calendar list referenced by id with the content of one specified or taken from the message payload.
Event updateEvent(String calendarId, String eventId, Event calendarEvent)
Updates an event.
[Expand]
Inherited Methods
From class org.mule.modules.google.AbstractGoogleOAuthConnector
From class java.lang.Object
From interface org.mule.api.context.MuleContextAware

Fields

private String accessToken

private String applicationName

Application name registered on Google API console

private Calendar client

The google api client

private GoogleCalendarClientFactory clientFactory

Factory to instantiate the underlying google client. Usually you don't need to override this. Most common use case of a custom value here is testing.

private String consumerKey

The OAuth2 consumer key

private String consumerSecret

The OAuth2 consumer secret

private String scope

The OAuth scopes you want to request

Public Constructors

public GoogleCalendarConnector ()

Public Methods

public void batchDeleteCalendar (Collection<Calendar> calendars)

Deletes many events in a batch

Parameters
calendars A collection with instances of @{link org.mule.module.google.calendar.model.Calendar} that are to be deleted
Throws
IOException if there's a communication error

public void batchDeleteEvent (String calendarId, Collection<Event> calendarEvents)

Deletes many events in a batch

Parameters
calendarId The id of the calendar containing the events to be deleted
calendarEvents A collection with instances of Event that are to be deleted
Throws
IOException if there's a communication error

public BatchResponse<Calendar> batchInsertCalendar (Collection<Calendar> calendars)

Inserts many calendars in a batch

Parameters
calendars A collection with instances of @{link org.mule.module.google.calendar.model.Calendar} that are to be inserted
Returns
  • an instance of org.mule.modules.google.api.client.batch.BatchResponse
Throws
IOException if there's a communication error

public BatchResponse<Event> batchInsertEvent (String calendarId, Collection<Event> calendarEvents)

Inserts many events as a batch

Parameters
calendarId The id of the calendar that's receiving the calendars
calendarEvents A collection with instances of Event that are to be inserted
Returns
  • an instance of org.mule.modules.google.api.client.batch.BatchResponse
Throws
IOException if there's a communication error

public BatchResponse<Calendar> batchUpdateCalendar (Collection<Calendar> calendars)

Updates many calendars in a batch

Parameters
calendars A collection with instances of @{link org.mule.module.google.calendar.model.Calendar} that are to be updated
Returns
  • an instance of org.mule.modules.google.api.client.batch.BatchResponse
Throws
IOException if there's a communication error

public BatchResponse<Event> batchUpdateEvent (String calendarId, Collection<Event> calendarEvents)

Updates many events in a batch

Parameters
calendarId The id of the calendar containing the events to be updated
calendarEvents A collection with instances of Event that are to be updated
Returns
  • an instance of org.mule.modules.google.api.client.batch.BatchResponse
Throws
IOException if there's a communication error

public void clearCalendar (String id)

Clears all the events on the calendar referenced by id

Parameters
id The id of the calendar you want to clear
Throws
IOException if there's a communication error

public Calendar createCalendar (Calendar calendar)

Inserts a new calendar associated with the user that owns the current OAuth token

Parameters
calendar An instance of Calendar with the information of the calendar you want to insert
Returns
  • another instance of Calendar representing the calendar that was created
Throws
IOException if there's a communication error

public void deleteAclRule (String calendarId, String ruleId)

Deletes an ACL rule on a calendar

Parameters
calendarId The id of the calendar loosing a rule
ruleId The id of the rule to be deleted
Throws
IOException if there's a communication error

public void deleteCalendar (String id)

Deletes a particular calendar referenced by id

Parameters
id The id of the calendar you want to delete
Throws
IOException if there's a communication error

public void deleteCalendarList (String id)

Deletes a calendar list referenced by id

Parameters
id The id of the calendar list you want to delete
Throws
IOException if there's a communication error

public void deleteEvent (String calendarId, String eventId)

Deletes an event from a specified calendar

Parameters
calendarId The id of the calendar containing the event
eventId The event's id
Throws
IOException if there's a communication error

public String getAccessToken ()

public AclRule getAclRuleById (String calendarId, String ruleId)

Retrieves a Rule by Id

Parameters
calendarId The id of the calendar containing the rule
ruleId The id of the rule
Returns
Throws
IOException if there's a communication error

public List<AclRule> getAllAclRules (String calendarId)

Returns all the Acl rules for a particular calendar

Parameters
calendarId The id of the calendar containing the rules
Returns
Throws
IOException if there's a communication error

public String getApplicationName ()

public Calendar getCalendarById (String id)

Returns a particular calendar specified by id

Parameters
id The id of the calendar you want to get
Returns
Throws
IOException if there's a communication error

public ProviderAwarePagingDelegate<CalendarList, AbstractGoogleOAuthConnector> getCalendarList (boolean showHidden, PagingConfiguration pagingConfiguration)

Returns a paginated iterator with instances of CalendarList listing the calendars of the user that owns the OAuth access token. Optional parameters are not considered in the search if not specified.

Parameters
showHidden If true, hidden calendars will be returned
pagingConfiguration The paging configuration object
Returns
Throws
IOException if there's a communication error

public CalendarList getCalendarListById (String id)

Returns a particular calendar list identified by id. The user owning the OAuth token needs to have permissions for reading that list

Parameters
id The id of the calendar list you want to get
Returns
Throws
IOException if there's a communication error

public Object getClient ()

public GoogleCalendarClientFactory getClientFactory ()

public String getConsumerKey ()

public String getConsumerSecret ()

public Event getEventById (String calendarId, String eventId)

Retrieves an event by id

Parameters
calendarId The id of the calendar containing the event
eventId The event's id
Returns
  • an instance of Event representing the event on google's servers
Throws
IOException if there's a communication error

public ProviderAwarePagingDelegate<Event, AbstractGoogleOAuthConnector> getEvents (String calendarId, String icalUID, Integer maxAttendees, String orderBy, String query, boolean showDeleted, boolean showHiddenInvitations, boolean singleEvents, String timeMin, String timeMax, String datetimeFormat, String timezone, String lastUpdated, PagingConfiguration pagingConfiguration)

Searchs and returns events matching the criteria parameters. If a criteria is not specified, then it is not applied

Parameters
calendarId The id of the colendar that contains the events
icalUID Specifies iCalendar UID (iCalUID) of events to be included in the response
maxAttendees The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned.
orderBy The order of the events returned in the result
query Free text search terms to find events that match these terms in any field, except for extended properties
showDeleted Whether to include deleted events (with 'eventStatus' equals 'cancelled') in the result.
showHiddenInvitations Whether to include hidden invitations in the result
singleEvents Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves.
timeMin Lower bound timestamp (inclusive) for an event's end time to filter by
timeMax Upper bound timestamp (exclusive) for an event's start time to filter by
datetimeFormat The timestamp format for timeMin, timeMax and lastUpdated. It defaults to RFC 3369 (yyyy-MM-dd'T'HH:mm:ssZ)
timezone Timezone in which timeMin, timeMax and lastUpdated is to be considered on
lastUpdated Lower bound timestamp for an event's last modification time to filter by
pagingConfiguration The paging configuration object
Returns
  • a paginated iterator of Event
Throws
IOException if there's a communication error

public FreeBusy getFreeTime (String timeMin, String timeMax, List<String> ids, String timezone, String datetimeFormat, Integer maxCalendarExpansion)

Returns the free time the authenticated user has between two times

Parameters
timeMin The start of the interval for the query
timeMax The end of the interval for the query
ids List of calendars and/or groups identifiers to query.
timezone Time zone used in the response
datetimeFormat The format to be used to parse timeMin and timeMax
maxCalendarExpansion Maximal number of calendars for which FreeBusy information is to be provided
Returns
Throws
IOException if there's a communication error

public ProviderAwarePagingDelegate<Event, AbstractGoogleOAuthConnector> getInstances (String calendarId, String eventId, Integer maxAttendess, boolean showDeleted, String timezone, String originalStart, PagingConfiguration pagingConfiguration)

For recurring events, it returns one instance of Event for each recurrence instance

Parameters
calendarId The id of the calendar containing the recurrent event
eventId The id of a recurrent event
maxAttendess The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned.
showDeleted Whether to include deleted events (with 'eventStatus' equals 'cancelled') in the result.
timezone Time zone used in the response
originalStart The original start time of the instance in the result
pagingConfiguration The paging configuration object
Returns
  • an auto paginated iterator of Event
Throws
IOException if there's a communication error

public String getScope ()

public Event importEvent (String calendarId, Event calendarEvent)

Imports the given event into a calendar

Parameters
calendarId The id of the target calendar
calendarEvent An instance of Event representing the event to be imported
Returns
  • an instance of Event representing the imported event on google's servers
Throws
IOException if there's a communication error

public void init ()

Initializes the connector. if no clientFactory was provided, then a default DefaultGoogleCalendarClientFactory wil be used instead

public AclRule insertAclRule (String calendarId, String scope, ScopeType scopeType, ScopeRole role)

Inserts a new ACL rule in a calendar

Parameters
calendarId The id of the calendar affected by the rule
scope The email address of a user or group, or the name of a domain, depending on the scope type. Omitted for type "default".
scopeType The type of the scope. Possible values are: - "default" - The public scope. This is the default value. "user" - Limits the scope to a single user. "group" - Limits the scope to a group. "domain" - Limits the scope to a domain. Note: The permissions granted to the "default", or public, scope apply to any user, authenticated or not.
role The role assigned to the scope. Possible values are: "none" - Provides no access. - "freeBusyReader" Provides read access to free/busy information. "reader" - Provides read access to the calendar. Private events will appear to users with reader access, but event details will be hidden. "writer" - Provides read and write access to the calendar. Private events will appear to users with writer access, and event details will be visible. "owner" - Provides ownership of the calendar. This role has all of the permissions of the writer role with the additional ability to see and manipulate ACLs.
Returns
  • an instance of AclRule representing the newly created rule
Throws
IOException if there's a communication error

public Event insertEvent (String calendarId, Event calendarEvent)

Inserts the given event into an specified calendar

Parameters
calendarId The id of the calendar that's to contain the event
calendarEvent An instance of Event representing the event to be inserted
Returns
  • an instance of Event representing the event inserted on google's servers
Throws
IOException if there's a communication error

public Event moveEvent (String sourceCalendarId, String eventId, String targetCalendarId)

Moves a calendar form one calendar to another

Parameters
sourceCalendarId The id of the calendar that currently has the event
eventId The id of the event to be moved
targetCalendarId The id of the calendar to receive the event
Returns
  • an instance of Event representing the moved event
Throws
IOException if there's a communication error

public void postAuth ()

public Event quickAddEvent (String calendarId, String text)

Shortcut method for creating an event with nothing but a description text.

Parameters
calendarId The id of the calendar to contain the new event
text Description of the new event
Returns
  • an instance of Event representing the newly created event
Throws
IOException if there's a communication error

public void setAccessToken (String accessToken)

Parameters
accessToken

public void setApplicationName (String applicationName)

Parameters
applicationName

public void setClientFactory (GoogleCalendarClientFactory clientFactory)

Parameters
clientFactory

public void setConsumerKey (String consumerKey)

Parameters
consumerKey

public void setConsumerSecret (String consumerSecret)

Parameters
consumerSecret

public void setScope (String scope)

Parameters
scope

public AclRule updateAclRule (String calendarId, String ruleId, AclRule aclRule)

Updates a rule on a given calendar

Parameters
calendarId The id of the calendar containing the rule
ruleId The id of the rule to be modified
aclRule An instance of AclRule containing the new state of the rule
Returns
  • an instance of AclRule representing the new updated state of the rule
Throws
IOException if there's a communication error

public Calendar updateCalendar (String id, Calendar calendar)

Updates a calendar referenced by id with the content of one specified or taken from the message payload.

Parameters
id The id of the calendar you want to get
calendar An instance of Calendar with the content you want to have reflected
Returns
  • an instance of Calendar representing the updated calendar's state
Throws
IOException if there's a communication error

public CalendarList updateCalendarList (String id, CalendarList calendarList)

Updates a calendar list referenced by id with the content of one specified or taken from the message payload.

Parameters
id The id of the calendar list you want to update
calendarList An instance of CalendarList with the content you want to have reflected
Returns
  • an instance of CalendarList with reflecting the calendar's updated state
Throws
IOException if there's a communication error

public Event updateEvent (String calendarId, String eventId, Event calendarEvent)

Updates an event.

Parameters
calendarId The id of the calendar that contains the event to be updated
eventId The if of the event to be updated
calendarEvent An instance of Event with the event's new state
Returns
  • an instance of Event representing the updated event
Throws
IOException if there's a communication error