use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class ICalFileCalendarManager method getGroupCalendar.
@Override
public KalendarRenderWrapper getGroupCalendar(BusinessGroup businessGroup) {
Kalendar cal = getCalendar(CalendarManager.TYPE_GROUP, businessGroup.getResourceableId().toString());
KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal, businessGroup.getName());
calendarWrapper.setCssClass(KalendarRenderWrapper.CALENDAR_COLOR_ORANGE);
calendarWrapper.setVisible(true);
return calendarWrapper;
}
use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class ICalFileCalendarManager method getCalendarForDeletion.
@Override
public KalendarRenderWrapper getCalendarForDeletion(OLATResourceable resource) {
String type;
if ("CourseModule".equals(resource.getResourceableTypeName())) {
type = CalendarManager.TYPE_COURSE;
} else {
type = CalendarManager.TYPE_GROUP;
}
Kalendar cal = getCalendar(type, resource.getResourceableId().toString());
KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal, "To delete");
calendarWrapper.setCssClass(KalendarRenderWrapper.CALENDAR_COLOR_GREEN);
calendarWrapper.setVisible(true);
return calendarWrapper;
}
use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class ICalFileCalendarManager method addEventTo.
@Override
public boolean addEventTo(final Kalendar cal, final List<KalendarEvent> kalendarEvents) {
OLATResourceable calOres = getOresHelperFor(cal);
Boolean persistSuccessful = CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(calOres, new SyncerCallback<Boolean>() {
@Override
public Boolean execute() {
Kalendar loadedCal = getCalendarFromCache(cal.getType(), cal.getCalendarID());
for (KalendarEvent kalendarEvent : kalendarEvents) {
loadedCal.addEvent(kalendarEvent);
kalendarEvent.resetImmutableDates();
}
boolean successfullyPersist = persistCalendar(loadedCal);
return new Boolean(successfullyPersist);
}
});
// inform all controller about calendar change for reload
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(new CalendarGUIModifiedEvent(cal), OresHelper.lookupType(CalendarManager.class));
return persistSuccessful.booleanValue();
}
use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class ICalFileCalendarManager method saveCalendarConfigForIdentity.
@Override
public void saveCalendarConfigForIdentity(KalendarRenderWrapper wrapper, Identity identity) {
Kalendar calendar = wrapper.getKalendar();
CalendarUserConfiguration configuration = calendarUserConfigDao.getCalendarUserConfiguration(identity, calendar.getCalendarID(), calendar.getType());
if (configuration == null) {
configuration = calendarUserConfigDao.createCalendarUserConfiguration(wrapper.getKalendar(), identity, wrapper.getToken(), wrapper.isInAggregatedFeed(), wrapper.isVisible());
} else {
configuration.setVisible(wrapper.isVisible());
configuration.setCssClass(wrapper.getCssClass());
configuration.setToken(wrapper.getToken());
configuration.setInAggregatedFeed(wrapper.isInAggregatedFeed());
configuration = calendarUserConfigDao.update(configuration);
}
}
use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class ICalFileCalendarManager method updateEventsFrom.
@Override
public boolean updateEventsFrom(Kalendar cal, List<KalendarEvent> kalendarEvents) {
final OLATResourceable calOres = getOresHelperFor(cal);
Boolean updatedSuccessful = CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(calOres, new SyncerCallback<Boolean>() {
@Override
public Boolean execute() {
Kalendar loadedCal = getCalendarFromCache(cal.getType(), cal.getCalendarID());
for (KalendarEvent kalendarEvent : kalendarEvents) {
// remove old event
loadedCal.removeEvent(kalendarEvent);
// add changed event
loadedCal.addEvent(kalendarEvent);
}
boolean successfullyPersist = persistCalendar(loadedCal);
// inform all controller about calendar change for reload
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(new CalendarGUIModifiedEvent(cal), OresHelper.lookupType(CalendarManager.class));
return successfullyPersist;
}
});
return updatedSuccessful.booleanValue();
}
Aggregations