Nov 28 2008
Vacation ala Google Calendar
I’ve been building a railo-hibernate-groovy fto (flex time off) vacation app in my “for fun” time at work and home. The goal is to get an application that can replace the arcane paper based system that my company currently uses.
I have most of the front end of the app done, but I needed a good calendar view to show the events. I decided I would use google calendars, so I wrote a little calender wrapper. Here is a snippet of the test driver class. GoogleCalendar is mine, the *Entry items are part of the api.
This is groovy code, not java…
//omitting calendar name assumes the default users calendar
GoogleCalendar gc1 = new GoogleCalendar(username,password)
// adds an event 3 days in duration starting 3 days from now, with title and desc here
CalendarEventEntry entry = gc1.insertEvent("DELETE ME FTO","FTO",new Date()+3,new Date()+6)
gc1.deleteEvent(entry)
println("List of users owned calendars:")
for (CalendarEntry cal : gc1.getCalendars()) {
println("\t" + cal.getTitle().getPlainText());
}
//this demonstrates the mixed constructor that is allowed in the groovy wrapper.
//i define a calendar name, and it looks it up and sets that as the calendar to work with
GoogleCalendar gc2 = new GoogleCalendar(username,password,"Web Services Team")
//adds an event 3 days in duration starting 2 days from now, with title and desc here on the WST calendar
gc2.insertEvent("Joshua FTO","FTO",new Date()+2,new Date()+5)
Such fun.
This will allow me to have a nice visual display of everyone’s scheduled vacation calendar, and have an easy way to share it with other apps/users such as our wiki.