本文整理汇总了Java中net.fortuna.ical4j.model.property.RRule.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java RRule.getValue方法的具体用法?Java RRule.getValue怎么用?Java RRule.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.fortuna.ical4j.model.property.RRule
的用法示例。
在下文中一共展示了RRule.getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateRRule
import net.fortuna.ical4j.model.property.RRule; //导入方法依赖的package包/类
public static String calculateRRule(final TeamEventRecurrenceData recurData)
{
if (recurData == null || recurData.getFrequency() == null || recurData.getFrequency() == RecurrenceFrequency.NONE) {
return null;
}
if (recurData.isCustomized() == false) {
recurData.setInterval(1);
}
final Recur recur = new Recur();
final net.fortuna.ical4j.model.Date untilDate = ICal4JUtils.getICal4jDate(recurData.getUntil(), recurData.getTimeZone());
if (untilDate != null) {
recur.setUntil(untilDate);
}
recur.setInterval(recurData.getInterval());
recur.setFrequency(ICal4JUtils.getCal4JFrequencyString(recurData.getFrequency()));
final RRule rrule = new RRule(recur);
return rrule.getValue();
}
示例2: getRecurrenceRule
import net.fortuna.ical4j.model.property.RRule; //导入方法依赖的package包/类
/**
* Build iCalendar-compliant recurrence rule
*
* @param recurrence
* @param recurrenceEnd
* @return rrule
*/
public static String getRecurrenceRule(final String recurrence, final Date recurrenceEnd) {
final TimeZone tz = TimeZoneRegistryFactory.getInstance().createRegistry().getTimeZone(java.util.Calendar.getInstance().getTimeZone().getID());
if (recurrence != null) { // recurrence available
// create recurrence rule
final StringBuilder sb = new StringBuilder();
sb.append("FREQ=");
if (recurrence.equals(CalendarEntry.WORKDAILY)) {
// build rule for monday to friday
sb.append(CalendarEntry.DAILY);
sb.append(";");
sb.append("BYDAY=MO,TU,WE,TH,FR");
} else if (recurrence.equals(CalendarEntry.BIWEEKLY)) {
// build rule for biweekly
sb.append(CalendarEntry.WEEKLY);
sb.append(";");
sb.append("INTERVAL=2");
} else {
// normal supported recurrence
sb.append(recurrence);
}
if (recurrenceEnd != null) {
final DateTime recurEndDT = new DateTime(recurrenceEnd.getTime());
recurEndDT.setTimeZone(tz);
sb.append(";");
sb.append(CalendarEntry.UNTIL);
sb.append("=");
sb.append(recurEndDT.toString());
}
try {
final Recur recur = new Recur(sb.toString());
final RRule rrule = new RRule(recur);
return rrule.getValue();
} catch (final ParseException e) {
log.error("cannot create recurrence rule: " + recurrence.toString(), e);
}
}
return null;
}