use of net.fortuna.ical4j.model.property.ExRule in project bw-calendar-engine by Bedework.
the class VEventUtil method doRecurring.
/**
* Build recurring properties from event.
*
* @param val
* @param pl
* @throws CalFacadeException
*/
public static void doRecurring(final BwEvent val, final PropertyList pl) throws CalFacadeException {
try {
if (val.hasRrules()) {
for (String s : val.getRrules()) {
RRule rule = new RRule();
rule.setValue(s);
pl.add(rule);
}
}
if (val.hasExrules()) {
for (String s : val.getExrules()) {
ExRule rule = new ExRule();
rule.setValue(s);
pl.add(rule);
}
}
makeDlp(val, false, val.getRdates(), pl);
makeDlp(val, true, val.getExdates(), pl);
} catch (CalFacadeException cfe) {
throw cfe;
} catch (Throwable t) {
throw new CalFacadeException(t);
}
}
use of net.fortuna.ical4j.model.property.ExRule in project bw-calendar-engine by Bedework.
the class IcalTranslator method xmlProperty.
private void xmlProperty(final XmlEmit xml, final Property val) throws CalFacadeException {
try {
QName tag = openTag(xml, val.getName());
ParameterList pl = val.getParameters();
if (pl.size() > 0) {
xml.openTag(XcalTags.parameters);
Iterator pli = pl.iterator();
while (pli.hasNext()) {
xmlParameter(xml, (Parameter) pli.next());
}
xml.closeTag(XcalTags.parameters);
}
PropertyInfoIndex pii = PropertyInfoIndex.fromName(val.getName());
QName ptype = XcalTags.textVal;
if (pii != null) {
DataType dtype = pii.getPtype();
if (dtype != null) {
ptype = dtype.getXcalType();
}
}
if (ptype == null) {
// Special processing I haven't done
warn("Unimplemented value type for " + val.getName());
ptype = XcalTags.textVal;
}
if (ptype.equals(XcalTags.recurVal)) {
// Emit individual parts of recur rule
xml.openTag(ptype);
Recur r;
if (val instanceof ExRule) {
r = ((ExRule) val).getRecur();
} else {
r = ((RRule) val).getRecur();
}
xml.property(XcalTags.freq, r.getFrequency());
xmlProp(xml, XcalTags.wkst, r.getWeekStartDay().name());
if (r.getUntil() != null) {
xmlProp(xml, XcalTags.until, r.getUntil().toString());
}
xmlProp(xml, XcalTags.count, String.valueOf(r.getCount()));
xmlProp(xml, XcalTags.interval, String.valueOf(r.getInterval()));
xmlProp(xml, XcalTags.bymonth, r.getMonthList());
xmlProp(xml, XcalTags.byweekno, r.getWeekNoList());
xmlProp(xml, XcalTags.byyearday, r.getYearDayList());
xmlProp(xml, XcalTags.bymonthday, r.getMonthDayList());
xmlProp(xml, XcalTags.byday, r.getDayList());
xmlProp(xml, XcalTags.byhour, r.getHourList());
xmlProp(xml, XcalTags.byminute, r.getMinuteList());
xmlProp(xml, XcalTags.bysecond, r.getSecondList());
xmlProp(xml, XcalTags.bysetpos, r.getSetPosList());
xml.closeTag(ptype);
} else {
xml.property(ptype, val.getValue());
}
xml.closeTag(tag);
} catch (CalFacadeException cfe) {
throw cfe;
} catch (Throwable t) {
throw new CalFacadeException(t);
}
}
use of net.fortuna.ical4j.model.property.ExRule in project ofbiz-framework by apache.
the class ICalRecurConverter method visit.
@Override
public void visit(Intersection expr) {
this.stateStack.push(this.state);
VisitorState newState = new VisitorState();
newState.isExcluded = this.state.isExcluded;
newState.isIntersection = true;
this.state = newState;
for (TemporalExpression childExpr : expr.getExpressionSet()) {
childExpr.accept(this);
}
this.state = this.stateStack.pop();
if (newState.inclRecurList.size() > 0) {
this.incRuleList.add(new RRule(this.consolidateRecurs(newState.inclRecurList)));
}
if (newState.exRecurList.size() > 0) {
this.exRuleList.add(new ExRule(this.consolidateRecurs(newState.exRecurList)));
}
}
Aggregations