Search in sources :

Example 1 with WsXMLTranslator

use of org.bedework.util.calendar.WsXMLTranslator in project bw-calendar-engine by Bedework.

the class IcalTranslator method fromIcal.

/**
 * Convert the Icalendar object to a Collection of Calendar objects
 *
 * @param col      collection the entities will live in - possibly null
 * @param ical
 * @param diff     True if we should assume we are updating existing events.
 * @return Icalendar
 * @throws CalFacadeException
 */
public Icalendar fromIcal(final BwCalendar col, final IcalendarType ical, final boolean diff) throws CalFacadeException {
    Icalendar ic = new Icalendar();
    setSystemProperties();
    WsXMLTranslator bldr = new WsXMLTranslator(ic);
    try {
        Calendar cal = bldr.fromXcal(ical);
        return makeIc(col, ic, cal, diff, false);
    } catch (CalFacadeException cfe) {
        throw cfe;
    } catch (Throwable t) {
        throw new CalFacadeException(t);
    }
}
Also used : BwCalendar(org.bedework.calfacade.BwCalendar) Calendar(net.fortuna.ical4j.model.Calendar) WsXMLTranslator(org.bedework.util.calendar.WsXMLTranslator) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 2 with WsXMLTranslator

use of org.bedework.util.calendar.WsXMLTranslator in project bw-calendar-engine by Bedework.

the class IcalTranslator method addOverride.

/**
 * Add an override as part of an update
 * @param ei
 * @param comp
 * @throws CalFacadeException
 */
public void addOverride(final EventInfo ei, final JAXBElement<? extends BaseComponentType> comp) throws CalFacadeException {
    try {
        Calendar cal = new WsXMLTranslator(new Icalendar()).fromXcomp(comp);
        if (cal == null) {
            return;
        }
        Icalendar ic = new Icalendar();
        ic.addComponent(ei);
        makeIc(null, ic, cal, true, false);
    } catch (CalFacadeException cfe) {
        throw cfe;
    } catch (Throwable t) {
        throw new CalFacadeException(t);
    }
}
Also used : BwCalendar(org.bedework.calfacade.BwCalendar) Calendar(net.fortuna.ical4j.model.Calendar) WsXMLTranslator(org.bedework.util.calendar.WsXMLTranslator) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Aggregations

Calendar (net.fortuna.ical4j.model.Calendar)2 BwCalendar (org.bedework.calfacade.BwCalendar)2 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)2 WsXMLTranslator (org.bedework.util.calendar.WsXMLTranslator)2