Index: api/src/java/org/sakaiproject/signup/logic/SakaiFacade.java =================================================================== --- api/src/java/org/sakaiproject/signup/logic/SakaiFacade.java (revision 308214) +++ api/src/java/org/sakaiproject/signup/logic/SakaiFacade.java (working copy) @@ -461,5 +461,6 @@ */ public boolean synchonizeGroupTitle(String siteId, String groupId, String newTitle); - + // Returns Google calendar if the calendar has been created in Google + public Calendar getAdditionalCalendar(String siteId) throws PermissionException; } Index: impl/src/java/org/sakaiproject/signup/logic/SakaiFacadeImpl.java =================================================================== --- impl/src/java/org/sakaiproject/signup/logic/SakaiFacadeImpl.java (revision 308214) +++ impl/src/java/org/sakaiproject/signup/logic/SakaiFacadeImpl.java (working copy) @@ -44,6 +44,7 @@ import org.sakaiproject.calendar.api.CalendarEdit; import org.sakaiproject.calendar.api.CalendarService; import org.sakaiproject.component.api.ServerConfigurationService; +import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.content.api.ContentHostingService; import org.sakaiproject.exception.IdInvalidException; import org.sakaiproject.exception.IdUnusedException; @@ -207,7 +208,22 @@ public void setAuthzGroupService(AuthzGroupService authzGroupService) { this.authzGroupService=authzGroupService; } - + // Returns Google calendar if the calendar has been created in Google + public Calendar getAdditionalCalendar(String siteId) throws PermissionException { + CalendarService additionalCalendarService = null; + additionalCalendarService = (CalendarService) ComponentManager.get(CalendarService.ADDITIONAL_CALENDAR); + if (additionalCalendarService != null){ + if (additionalCalendarService.isCalendarToolInitialized(siteId)) { + try { + return additionalCalendarService.getCalendar(siteId); + } catch (IdUnusedException e) { + log.error("Error retrieving Calendar." + e.getMessage()); + } + } + } + return null; + } + /** * regist all the permission levels, which Signup Tool required. Place any * code that should run when this class is initialized by spring here Index: impl/src/java/org/sakaiproject/signup/logic/SignupMeetingServiceImpl.java =================================================================== --- impl/src/java/org/sakaiproject/signup/logic/SignupMeetingServiceImpl.java (revision 308214) +++ impl/src/java/org/sakaiproject/signup/logic/SignupMeetingServiceImpl.java (working copy) @@ -648,7 +648,8 @@ for (SignupTimeslot calendarBlock : calendarBlocks) { for (SignupSite site : signupSites) { try { - Calendar calendar = sakaiFacade.getCalendar(site.getSiteId()); + Calendar calendar = chooseCalendar(site); + if (calendar == null)// something went wrong when fetching the calendar continue; @@ -916,7 +917,8 @@ for (SignupSite site : sites) { try { - Calendar calendar = sakaiFacade.getCalendar(site.getSiteId()); + Calendar calendar = chooseCalendar(site); + if (calendar == null)// something went wrong when fetching the calendar continue; @@ -960,6 +962,16 @@ } } + + // See if additional calendar is deployed and ready to use. + // If not, we use the Sakai calendar tool by default. + private Calendar chooseCalendar(SignupSite site) throws PermissionException { + Calendar calendar = sakaiFacade.getAdditionalCalendar(site.getSiteId()); + if (calendar == null) { + calendar = sakaiFacade.getCalendar(site.getSiteId()); + } + return calendar; + } /** * {@inheritDoc}