use of ietf.params.xml.ns.icalendar_2.RrulePropType in project bw-calendar-engine by Bedework.
the class ToXEvent method doRecurring.
/**
* Build recurring properties from event.
*
* @param pattern
* @param compCl - component class for pattern matching
* @param val
* @param pl
* @throws CalFacadeException
*/
public static void doRecurring(final BaseComponentType pattern, final Class compCl, final BwEvent val, final List<JAXBElement<? extends BasePropertyType>> pl) throws CalFacadeException {
try {
if (emit(pattern, compCl, RrulePropType.class) && val.hasRrules()) {
for (String s : val.getRrules()) {
RRule rule = new RRule();
rule.setValue(s);
Recur r = rule.getRecur();
RecurType rt = new RecurType();
rt.setFreq(FreqRecurType.fromValue(r.getFrequency()));
if (r.getCount() > 0) {
rt.setCount(BigInteger.valueOf(r.getCount()));
}
Date until = r.getUntil();
if (until != null) {
UntilRecurType u = new UntilRecurType();
/*
if (until instanceof DateTime) {
u.setDateTime(until.toString());
} else {
u.setDate(until.toString());
}
*/
XcalUtil.initUntilRecur(u, until.toString());
}
if (r.getInterval() > 0) {
rt.setInterval(String.valueOf(r.getInterval()));
}
listFromNumberList(rt.getBysecond(), r.getSecondList());
listFromNumberList(rt.getByminute(), r.getMinuteList());
listFromNumberList(rt.getByhour(), r.getHourList());
if (r.getDayList() != null) {
List<String> l = rt.getByday();
for (WeekDay wd : r.getDayList()) {
l.add(wd.getDay().name());
}
}
listFromNumberList(rt.getByyearday(), r.getYearDayList());
intlistFromNumberList(rt.getBymonthday(), r.getMonthDayList());
listFromNumberList(rt.getByweekno(), r.getWeekNoList());
intlistFromNumberList(rt.getBymonth(), r.getMonthList());
bigintlistFromNumberList(rt.getBysetpos(), r.getSetPosList());
RrulePropType rrp = new RrulePropType();
rrp.setRecur(rt);
pl.add(of.createRrule(rrp));
}
}
/*
if (emit(pattern, compCl, ExrulePropType.class) &&
val.hasExrules()) {
for(String s: val.getExrules()) {
ExRule rule = new ExRule();
rule.setValue(s);
pl.add(rule);
}
}
if (emit(pattern, compCl, RdatePropType.class) {
makeDlp(false, val.getRdates(), pl);
}
if (emit(pattern, compCl, ExdatePropType.class) {
makeDlp(true, val.getExdates(), pl);
}
*/
// } catch (CalFacadeException cfe) {
// throw cfe;
} catch (Throwable t) {
throw new CalFacadeException(t);
}
}
Aggregations