use of org.apache.openmeetings.db.entity.calendar.OmCalendar in project openmeetings by apache.
the class CalendarDialog method setFormModelObject.
// Sets the form model object if the calendar cannot be reached. Returns true if model is set
private boolean setFormModelObject(Appointment a, IPartialPageRequestHandler target) {
OmCalendar c = a.getCalendar();
if (apptManager.testConnection(calendarPanel.getHttpClient(), c)) {
return false;
}
setFormModelObject(c);
setButtons(target);
return true;
}
use of org.apache.openmeetings.db.entity.calendar.OmCalendar in project openmeetings by apache.
the class CalendarDialog method setFormModelObject.
// Sets the form object when in need of syncing. Returns true if model is set
private boolean setFormModelObject() {
if (cals != null && !cals.isEmpty() && calIndex < cals.size()) {
OmCalendar calendar = cals.get(calIndex++);
HttpClient client = calendarPanel.getHttpClient();
if (!apptManager.testConnection(client, calendar)) {
form.setModelObject(calendar);
form.url.setModelObject(calendar.getHref());
return true;
} else {
apptManager.syncItem(client, calendar);
return setFormModelObject();
}
}
cals = null;
return false;
}
use of org.apache.openmeetings.db.entity.calendar.OmCalendar in project openmeetings by apache.
the class CalendarDialog method setButtons.
public void setButtons(IPartialPageRequestHandler target) {
switch(type) {
case UPDATE_APPOINTMENT:
case DELETE_APPOINTMENT:
case SYNC_CALENDAR:
delete.setVisible(false, target);
save.setVisible(true, target);
break;
case UPDATE_CALENDAR:
OmCalendar c = form.getModelObject();
if (c.getId() == null) {
delete.setVisible(false, target);
} else {
delete.setVisible(isOwner(c), target);
}
save.setVisible(isOwner(c), target);
}
}
use of org.apache.openmeetings.db.entity.calendar.OmCalendar in project openmeetings by apache.
the class BackupImport method importCalendars.
/*
* ##################### Import Calendars
*/
private void importCalendars(File f) throws Exception {
log.info("Chat messages import complete, starting calendar import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, new UserConverter(userDao, userMap));
List<OmCalendar> list = readList(serializer, f, "calendars.xml", "calendars", OmCalendar.class, true);
for (OmCalendar c : list) {
Long id = c.getId();
c.setId(null);
c = calendarDao.update(c);
calendarMap.put(id, c.getId());
}
}
use of org.apache.openmeetings.db.entity.calendar.OmCalendar in project openmeetings by apache.
the class OmCalendarConverter method read.
@Override
public OmCalendar read(InputNode node) throws Exception {
long oldId = toLong(node.getValue());
Long newId = idMap.containsKey(oldId) ? idMap.get(oldId) : oldId;
OmCalendar c = calendarDao.get(newId);
return c == null ? new OmCalendar() : c;
}
Aggregations