Package com.logicaldoc.google
Class CalendarClient
java.lang.Object
com.logicaldoc.google.GoogleClient
com.logicaldoc.google.CalendarClient
Facade for Google Calendar.
To handle the API: https://console.developers.google.com
- Since:
- 78.9.4
- Author:
- Marco Meschieri - LogicalDOC
-
Method Summary
Modifier and TypeMethodDescriptionvoid
connect
(com.google.api.client.auth.oauth2.Credential credential) Connects to remote APIvoid
deleteEvent
(String eventId) Deletes a remote eventstatic CalendarClient
get
(long userId) Retrieves all the upcoming events from the remote calendar synchronising at the same time the local counterpartsboolean
Checks if the client is connected to the remote APIPublishes a local event to the remote calendar, if the event does not exist it is created otherwise it gets synchronized.void
Synchronizes the local calendar with the Google oneMethods inherited from class com.logicaldoc.google.GoogleClient
getUserId, loadSettings
-
Method Details
-
get
public static CalendarClient get(long userId) throws com.logicaldoc.core.PersistenceException, com.logicaldoc.util.security.StringEncrypter.EncryptionException, IOException - Throws:
com.logicaldoc.core.PersistenceException
com.logicaldoc.util.security.StringEncrypter.EncryptionException
IOException
-
isConnected
public boolean isConnected()Description copied from class:GoogleClient
Checks if the client is connected to the remote API- Specified by:
isConnected
in classGoogleClient
- Returns:
- true only if it is connected
-
connect
public void connect(com.google.api.client.auth.oauth2.Credential credential) Description copied from class:GoogleClient
Connects to remote API- Specified by:
connect
in classGoogleClient
- Parameters:
credential
- the credentials to use
-
getUpcomingEvents
public List<Event> getUpcomingEvents() throws IOException, com.logicaldoc.core.PersistenceException, ParseExceptionRetrieves all the upcoming events from the remote calendar synchronising at the same time the local counterparts- Returns:
- The local future calendar events
- Throws:
IOException
- Error in the I/Ocom.logicaldoc.core.PersistenceException
- Error in the data layerParseException
- Error parting the dates
-
deleteEvent
Deletes a remote event- Parameters:
eventId
- Identifi3er of the event to delete- Throws:
IOException
- Error in the I/O
-
pushEvent
public String pushEvent(Event localEvent) throws IOException, com.logicaldoc.core.PersistenceException, ParseException Publishes a local event to the remote calendar, if the event does not exist it is created otherwise it gets synchronized.- Parameters:
localEvent
- The local event to publish- Returns:
- The external identifier of the remote event
- Throws:
IOException
- Error in the I/Ocom.logicaldoc.core.PersistenceException
- Error in the data layerParseException
- Error in the JSON manipulation
-
synchronize
public void synchronize() throws com.logicaldoc.core.PersistenceException, IOException, ParseExceptionSynchronizes the local calendar with the Google one- Throws:
ParseException
- Exception parsing the datesIOException
- Generic I/O errorcom.logicaldoc.core.PersistenceException
- Error in the data layer
-