Class CalendarClient

java.lang.Object
com.logicaldoc.google.GoogleClient
com.logicaldoc.google.CalendarClient

public class CalendarClient extends GoogleClient
Facade for Google Calendar. To handle the API: https://console.developers.google.com
Since:
78.9.4
Author:
Marco Meschieri - LogicalDOC
  • 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 class GoogleClient
      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 class GoogleClient
      Parameters:
      credential - the credentials to use
    • getUpcomingEvents

      public List<Event> getUpcomingEvents() throws IOException, com.logicaldoc.core.PersistenceException, ParseException
      Retrieves 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/O
      com.logicaldoc.core.PersistenceException - Error in the data layer
      ParseException - Error parting the dates
    • deleteEvent

      public void deleteEvent(String eventId) throws IOException
      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/O
      com.logicaldoc.core.PersistenceException - Error in the data layer
      ParseException - Error in the JSON manipulation
    • synchronize

      public void synchronize() throws com.logicaldoc.core.PersistenceException, IOException, ParseException
      Synchronizes the local calendar with the Google one
      Throws:
      ParseException - Exception parsing the dates
      IOException - Generic I/O error
      com.logicaldoc.core.PersistenceException - Error in the data layer