Search in sources :

Example 1 with OmCalendar

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;
}
Also used : OmCalendar(org.apache.openmeetings.db.entity.calendar.OmCalendar)

Example 2 with OmCalendar

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;
}
Also used : HttpClient(org.apache.commons.httpclient.HttpClient) OmCalendar(org.apache.openmeetings.db.entity.calendar.OmCalendar)

Example 3 with OmCalendar

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);
    }
}
Also used : OmCalendar(org.apache.openmeetings.db.entity.calendar.OmCalendar)

Example 4 with OmCalendar

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());
    }
}
Also used : UserConverter(org.apache.openmeetings.backup.converter.UserConverter) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Strategy(org.simpleframework.xml.strategy.Strategy) OmCalendar(org.apache.openmeetings.db.entity.calendar.OmCalendar) Registry(org.simpleframework.xml.convert.Registry) Persister(org.simpleframework.xml.core.Persister) Serializer(org.simpleframework.xml.Serializer)

Example 5 with OmCalendar

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;
}
Also used : NumberUtils.toLong(org.apache.commons.lang3.math.NumberUtils.toLong) OmCalendar(org.apache.openmeetings.db.entity.calendar.OmCalendar)

Aggregations

OmCalendar (org.apache.openmeetings.db.entity.calendar.OmCalendar)14 IOException (java.io.IOException)2 HttpClient (org.apache.commons.httpclient.HttpClient)2 SyncType (org.apache.openmeetings.db.entity.calendar.OmCalendar.SyncType)2 CalendarHandler (org.apache.openmeetings.service.calendar.caldav.handler.CalendarHandler)2 EtagsHandler (org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler)2 Serializer (org.simpleframework.xml.Serializer)2 Registry (org.simpleframework.xml.convert.Registry)2 RegistryStrategy (org.simpleframework.xml.convert.RegistryStrategy)2 Persister (org.simpleframework.xml.core.Persister)2 Strategy (org.simpleframework.xml.strategy.Strategy)2 JSONArray (com.github.openjson.JSONArray)1 JSONObject (com.github.openjson.JSONObject)1 Options (com.googlecode.wicket.jquery.core.Options)1 Calendar (com.googlecode.wicket.jquery.ui.calendar.Calendar)1 CalendarView (com.googlecode.wicket.jquery.ui.calendar.CalendarView)1 GoogleCalendar (com.googlecode.wicket.jquery.ui.calendar.EventSource.GoogleCalendar)1 Button (com.googlecode.wicket.jquery.ui.form.button.Button)1 LocalDateTime (java.time.LocalDateTime)1 ArrayList (java.util.ArrayList)1