private String fromList(final List<?> l, final boolean quote) { return fromList(l, quote, ","); }
/** * @param t */ public static void error(final Throwable t) { getLog().error(WsXMLTranslator.class, t); }
private void processCalcomps(final BaseComponentType c, final BuildState bs) throws Throwable { List<JAXBElement<? extends BaseComponentType>> comps = XcalUtil.getComponents(c); if (comps == null) { return; } for (JAXBElement<? extends BaseComponentType> el: comps) { processComponent(el.getValue(), bs); } }
private boolean processValue(final BasePropertyType prop, final BuildState bs) throws Throwable { if (prop instanceof RecurPropertyType) { propVal(bs, fromRecurProperty((RecurPropertyType)prop)); propVal(bs, dp.getDuration()); propVal(bs, tp.getText()); propVal(bs, fromList(p.getText(), false)); propVal(bs, cap.getCalAddress()); propVal(bs, String.valueOf(ip.getInteger())); propVal(bs, p.getUri()); propVal(bs, p.getUtcOffset()); propVal(bs, XcalUtil.getIcalFormatDateTime(p.getUtcDateTime().toString())); propVal(bs, XcalUtil.getIcalFormatDateTime(p.getDateTime().toString())); propVal(bs, dtTzid.dt); propVal(bs, p.getText().name()); propVal(bs, p.getUri()); } else { propVal(bs, p.getBinary());
/** 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); } }
private void processVcalendar(final VcalendarType vcal, final BuildState bs) throws Throwable { bs.getContentHandler().startCalendar(); processProperties(vcal.getProperties(), bs); processCalcomps(vcal, bs); }
addRecurEl(rels, "FREQ", r.getFreq()); addRecurEl(rels, "COUNT", r.getCount()); addRecurEl(rels, "INTERVAL", r.getInterval()); addRecurEl(rels, "BYSECOND", r.getBysecond()); addRecurEl(rels, "BYMINUTE", r.getByminute()); addRecurEl(rels, "BYHOUR", r.getByhour()); addRecurEl(rels, "BYDAY", r.getByday()); addRecurEl(rels, "BYMONTHDAY", r.getBymonthday()); addRecurEl(rels, "BYYEARDAY", r.getByyearday()); addRecurEl(rels, "BYWEEKNO", r.getByweekno()); addRecurEl(rels, "BYMONTH", r.getBymonth()); addRecurEl(rels, "BYSETPOS", r.getBysetpos()); addRecurEl(rels, "WKST", r.getWkst()); return fromList(rels, false, ";");
name = getParValue(e.getValue()); bs.getContentHandler().parameter(parName, getParValue(e.getValue())); if (!processValue(prop, bs)) { throw new Exception("Bad property " + prop);
/** 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); } }
/** * @param comp * @return Calendar object or null for no data * @throws Throwable */ public Calendar fromXcomp(final JAXBElement<? extends BaseComponentType> comp) throws Throwable { IcalendarType ical = new IcalendarType(); List<VcalendarType> vcts = ical.getVcalendar(); VcalendarType vcal = new VcalendarType(); vcts.add(vcal); ArrayOfComponents aop = new ArrayOfComponents(); vcal.setComponents(aop); aop.getBaseComponent().add(comp); return fromXcal(ical); }
private void processComponent(final BaseComponentType comp, final BuildState bs) throws Throwable { final ComponentInfoIndex cii = ComponentInfoIndex.fromXmlClass(comp.getClass()); if (cii == null) { throw new Exception("Unknown component " + comp.getClass()); } final String name = cii.getPname(); bs.getContentHandler().startComponent(name); processProperties(comp.getProperties(), bs); processCalcomps(comp, bs); bs.getContentHandler().endComponent(name); }
private void addRecurEl(final List<String> l, final String name, final Object o) { if (o == null) { return; } String val; if (o instanceof List) { val = fromList((List<?>)o, false); if (val == null) { return; } } else { val = String.valueOf(o); } l.add(name + "=" + val); }
/** * @param msg */ public static void warn(final String msg) { getLog().warn(msg); } }
private String getParValue(final BaseParameterType bpt) throws Throwable { if (bpt instanceof TextParameterType) { return ((TextParameterType)bpt).getText(); } if (bpt instanceof DurationParameterType) { return ((DurationParameterType)bpt).getDuration().toString(); } if (bpt instanceof RangeParamType) { return ((RangeParamType)bpt).getText().value(); } if (bpt instanceof CalAddressListParamType) { return fromList(((CalAddressListParamType)bpt).getCalAddress(), true); } if (bpt instanceof CalAddressParamType) { return ((CalAddressParamType)bpt).getCalAddress(); } if (bpt instanceof UriParameterType) { return ((UriParameterType)bpt).getUri(); } throw new Exception("Unsupported param type"); }