public TeamEventRecurrenceData(final Recur recur, final TimeZone timeZone) {
   this.timeZone = timeZone;
   if (recur == null) {
     return;
   }
   this.interval = recur.getInterval();
   if (this.interval < 1) {
     this.interval = 1;
   }
   if (recur.getUntil() != null) {
     this.until = CalendarUtils.getEndOfDay(recur.getUntil(), timeZone);
   }
   this.frequency = ICal4JUtils.getFrequency(recur);
 }
Beispiel #2
0
  /**
   * Build recurring properties from ical recurrence.
   *
   * @param r
   * @return RecurTyp filled in
   * @throws Throwable
   */
  public static RecurType doRecur(final Recur r) throws Throwable {
    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();
      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 (Object o : r.getDayList()) {
        l.add(((WeekDay) o).getDay());
      }
    }

    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());

    return rt;
  }