com.knowgate.gdata
Class GCalendarSynchronizer

java.lang.Object
  extended by com.knowgate.gdata.GCalendarSynchronizer

public class GCalendarSynchronizer
extends java.lang.Object

Synchronize hipergate calendar with Google Calendar


Constructor Summary
GCalendarSynchronizer()
           
 
Method Summary
 boolean connect(JDCConnection oConn, java.lang.String sUser, java.lang.String sWorkArea, DistributedCachePeer oCache)
          Conect to Google Calendar Service This method looks for a PasswordRecord at table k_user_pwd which id_pwd column value is 'gmail'.
 void deleteMeetingFromGoogle(JDCConnection oConn, Meeting oMeet)
          Delete Google Calendar Event Entry which iCalendar UID is the same as the one of the given Meeting
 java.util.ArrayList<Meeting> readMeetingsFromGoogle(JDCConnection oConn, java.util.Date dtFrom, java.util.Date dtTo)
          Read Google Calendar Event Entries for a date range
 void writeMeetingToGoogle(JDCConnection oConn, Meeting oMeet)
          Create or update an hipergate Meeting as a Google Calendar Event Entry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GCalendarSynchronizer

public GCalendarSynchronizer()
Method Detail

connect

public boolean connect(JDCConnection oConn,
                       java.lang.String sUser,
                       java.lang.String sWorkArea,
                       DistributedCachePeer oCache)
                throws java.io.IOException,
                       java.sql.SQLException,
                       java.net.MalformedURLException,
                       AuthenticationException,
                       ServiceException

Conect to Google Calendar Service

This method looks for a PasswordRecord at table k_user_pwd which id_pwd column value is 'gmail'. If a PasswordRecord for gmail exists and its cal field has a non-empty value, then a connection attempt with Google Calendar Service is made. The matching between Google event objects and hipergate meeting objects is done with the iCalendar Unique Identifier of the object retrieved with method CalendarEventEntry.getIcalUID() from Google and with method Meeting.getString(DB.id_calendar) from hipergate. If a new iCalendar UID must be generated by hipergate, this will be the GUID of the Meeting concatenated with '@hipergate.org'. The time zone for the dates will be the one of the Fellow corresponding to the ACLUser with sUser GUID. If no time zone is set the GMT will be assumed.

Parameters:
oConn - JDCConnection Opened JDBC database connection
sUser - GUID of hipergate user (from k_users table)
sWorkArea - GUID of hipergate calendar work area (from k_workareas table)
DistributedCachePeer - Optional instance of a cache for reducing database accesses
Returns:
true if connection was successfull, false otherwise.
Throws:
java.io.IOException
java.sql.SQLException
java.net.MalformedURLException
AuthenticationException
ServiceException

readMeetingsFromGoogle

public java.util.ArrayList<Meeting> readMeetingsFromGoogle(JDCConnection oConn,
                                                           java.util.Date dtFrom,
                                                           java.util.Date dtTo)
                                                    throws java.io.IOException,
                                                           java.sql.SQLException,
                                                           java.net.MalformedURLException,
                                                           ServiceException

Read Google Calendar Event Entries for a date range

Parameters:
oConn - JDCConnection Opened JDBC database connection
dtFrom - Date interval start
dtTo - Date interval end
Returns:
ArrayList The retrieved Google event entries represented as hipergate Meeting objects.
Throws:
java.io.IOException
java.sql.SQLException
java.net.MalformedURLException
ServiceException

writeMeetingToGoogle

public void writeMeetingToGoogle(JDCConnection oConn,
                                 Meeting oMeet)
                          throws java.io.IOException,
                                 java.sql.SQLException,
                                 java.net.MalformedURLException,
                                 ServiceException

Create or update an hipergate Meeting as a Google Calendar Event Entry

Parameters:
oConn - JDCConnection Opened JDBC database connection
Meeting - Fully loaded instance of hipergate Meeting to be written to Google Calendar
Throws:
java.io.IOException
java.sql.SQLException
java.net.MalformedURLException
ServiceException

deleteMeetingFromGoogle

public void deleteMeetingFromGoogle(JDCConnection oConn,
                                    Meeting oMeet)
                             throws java.io.IOException,
                                    java.sql.SQLException,
                                    java.net.MalformedURLException,
                                    ServiceException

Delete Google Calendar Event Entry which iCalendar UID is the same as the one of the given Meeting

Parameters:
oConn - JDCConnection Opened JDBC database connection
Meeting - Fully loaded instance of hipergate Meeting to be deleted from Google Calendar
Throws:
java.io.IOException
java.sql.SQLException
java.net.MalformedURLException
ServiceException