当前位置: 首页>>代码示例>>Java>>正文


Java ExDate类代码示例

本文整理汇总了Java中net.fortuna.ical4j.model.property.ExDate的典型用法代码示例。如果您正苦于以下问题:Java ExDate类的具体用法?Java ExDate怎么用?Java ExDate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExDate类属于net.fortuna.ical4j.model.property包,在下文中一共展示了ExDate类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setExceptionDates

import net.fortuna.ical4j.model.property.ExDate; //导入依赖的package包/类
public void setExceptionDates(DateList dates) {
    if (dates == null) {
        return;
    }
    
    PropertyList<Property> properties = getEvent().getProperties();
    for (Property exdate : properties.getProperties(Property.EXDATE)) {
        properties.remove(exdate);
    }
    if (dates.isEmpty()) {
        return;
    }
    
    ExDate exDate = new ExDate(dates);
    setDateListPropertyValue(exDate);
    properties.add(exDate);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:18,代码来源:HibBaseEventStamp.java

示例2: setExceptionDates

import net.fortuna.ical4j.model.property.ExDate; //导入依赖的package包/类
/**
 * Sets exception dates.
 * @param dates The date list.
 */    
public void setExceptionDates(DateList dates) {
    if (dates == null) {
        return;
    }
    
    PropertyList<Property> properties = getEvent().getProperties();
    for (Property exdate : properties.getProperties(Property.EXDATE)) {
        properties.remove(exdate);
    }
    if (dates.isEmpty()) {
        return;
    }
    
    ExDate exDate = new ExDate(dates);
    setDateListPropertyValue(exDate);
    properties.add(exDate);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:22,代码来源:MockBaseEventStamp.java

示例3: getRecurrenceExcludeDates

import net.fortuna.ical4j.model.property.ExDate; //导入依赖的package包/类
/**
 * Create list with excluded dates based on the exclusion rule.
 * 
 * @param recurrenceExc
 * @return list with excluded dates
 */
private List<Date> getRecurrenceExcludeDates(final String recurrenceExc) {
    final List<Date> recurExcDates = new ArrayList<Date>();
    if (recurrenceExc != null && !recurrenceExc.equals("")) {
        try {
            final net.fortuna.ical4j.model.ParameterList pl = new net.fortuna.ical4j.model.ParameterList();
            final ExDate exdate = new ExDate(pl, recurrenceExc);
            final DateList dl = exdate.getDates();
            for (final Object date : dl) {
                final Date excDate = (Date) date;
                recurExcDates.add(excDate);
            }
        } catch (final ParseException e) {
            log.error("cannot restore recurrence exceptions", e);
        }
    }

    return recurExcDates;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:25,代码来源:CalendarEntry.java

示例4: fixExDates

import net.fortuna.ical4j.model.property.ExDate; //导入依赖的package包/类
private void fixExDates(Component comp) throws Exception {
    PropertyList<ExDate> exDates = comp.getProperties(Property.EXDATE);
    List<Property> toAdd = new ArrayList<>();
    List<Property> toRemove = new ArrayList<>();
    
    for(ExDate exDate : exDates) {            
        // ical likes a single exdate
        if(exDate.getDates().size()==1) {
            continue;
        }
        
        // remove exdate with multiple dates
        toRemove.add(exDate);
        
        // create single dates instead
        for(Date date : exDate.getDates()) {
            ExDate singleEx = (ExDate) exDate.copy();
            singleEx.getDates().clear();                 
            singleEx.getDates().add(date);
            toAdd.add(singleEx);
        }
    }
    
    // remove exdates with multiple dates
    comp.getProperties().removeAll(toRemove);
    
    // Add all single exdates
    comp.getProperties().addAll(toAdd);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:30,代码来源:ICal3ClientFilter.java

示例5: getRecurrenceExcludeRule

import net.fortuna.ical4j.model.property.ExDate; //导入依赖的package包/类
/**
 * Create exclusion rule based on list with dates.
 * 
 * @param dates
 * @return string with exclude rule
 */
private static String getRecurrenceExcludeRule(final List<Date> dates) {
    if (dates != null && dates.size() > 0) {
        final DateList dl = new DateList();
        for (final Date date : dates) {
            final net.fortuna.ical4j.model.Date dd = new net.fortuna.ical4j.model.Date(date);
            dl.add(dd);
        }
        final ExDate exdate = new ExDate(dl);
        return exdate.getValue();
    }

    return null;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:20,代码来源:CalendarEntry.java

示例6: createTestEvent

import net.fortuna.ical4j.model.property.ExDate; //导入依赖的package包/类
private void createTestEvent(LocalCalendar calendar) {
    try {
        TimeZone tzVienna = DateUtils.tzRegistry.getTimeZone("Europe/Vienna");

        Event event = new Event();
        event.uid = "[email protected]";
        event.summary = "Sample event";
        event.description = "Sample event with date/time";
        event.location = "Sample location";
        event.dtStart = new DtStart("20150501T120000", tzVienna);
        event.dtEnd = new DtEnd("20150501T130000", tzVienna);
        event.organizer = new Organizer(new URI("mailto:[email protected]"));
        event.rRule = new RRule("FREQ=DAILY;COUNT=10");
        event.forPublic = false;
        event.status = Status.VEVENT_CONFIRMED;

        // set an alarm one day, two hours, three minutes and four seconds before begin of event
        event.alarms.add(new VAlarm(new Dur(-1, -2, -3, -4)));

        // add two attendees
        event.attendees.add(new Attendee(new URI("mailto:[email protected]")));
        event.attendees.add(new Attendee(new URI("mailto:[email protected]")));

        // add exception with alarm and attendee
        Event exception = new Event();
        exception.recurrenceId = new RecurrenceId("20150502T120000", tzVienna);
        exception.summary = "Exception for sample event";
        exception.dtStart = new DtStart("20150502T140000", tzVienna);
        exception.dtEnd = new DtEnd("20150502T150000", tzVienna);
        exception.alarms.add(new VAlarm(new Dur(-2, -3, -4, -5)));
        exception.attendees.add(new Attendee(new URI("mailto:[email protected]")));
        event.exceptions.add(exception);

        // add EXDATE
        event.exDates.add(new ExDate(new DateList("20150502T120000", Value.DATE_TIME, tzVienna)));
        // add to calendar
        Uri uri = new LocalEvent(calendar, event, null, null).add();

        showMessage("Event created: " + uri);
        showEvents(calendar);
    } catch (Exception e) {
        e.printStackTrace();
        showMessage(e.toString());
    }
}
 
开发者ID:6thsolution,项目名称:EasyAppleSyncAdapter,代码行数:46,代码来源:MainActivity.java

示例7: createTeamEventDO

import net.fortuna.ical4j.model.property.ExDate; //导入依赖的package包/类
public static TeamEventDO createTeamEventDO(final VEvent event)
{
  final TeamEventDO teamEvent = new TeamEventDO();
  final DtStart dtStart = event.getStartDate();
  final String value = dtStart.toString();
  if (value.indexOf("VALUE=DATE") >= 0) {
    teamEvent.setAllDay(true);
  }
  Timestamp timestamp = ICal4JUtils.getSqlTimestamp(dtStart.getDate());
  teamEvent.setStartDate(timestamp);
  if (teamEvent.isAllDay() == true) {
    final org.joda.time.DateTime jodaTime = new org.joda.time.DateTime(event.getEndDate().getDate());
    final net.fortuna.ical4j.model.Date fortunaEndDate = new net.fortuna.ical4j.model.Date(jodaTime.plusDays(-1).toDate());
    timestamp = new Timestamp(fortunaEndDate.getTime());
  } else {
    timestamp = ICal4JUtils.getSqlTimestamp(event.getEndDate().getDate());
  }
  teamEvent.setEndDate(timestamp);
  if (event.getUid() != null) {
    teamEvent.setExternalUid(event.getUid().getValue());
  }
  if (event.getLocation() != null) {
    teamEvent.setLocation(event.getLocation().getValue());
  }
  if (event.getDescription() != null) {
    teamEvent.setNote(event.getDescription().getValue());
  }
  if (event.getSummary() != null) {
    teamEvent.setSubject(event.getSummary().getValue());
  } else {
    teamEvent.setSubject("");
  }
  if (event.getOrganizer() != null) {
    teamEvent.setOrganizer(event.getOrganizer().getValue());
  }
  @SuppressWarnings("unchecked")
  final List<VAlarm> alarms = event.getAlarms();
  if (alarms != null && alarms.size() >= 1) {
    final Dur dur = alarms.get(0).getTrigger().getDuration();
    if (dur != null) { // Might be null.
      // consider weeks
      int weeksToDays = 0;
      if (dur.getWeeks() != 0) {
        weeksToDays = dur.getWeeks() * DURATION_OF_WEEK;
      }
      if (dur.getDays() != 0) {
        teamEvent.setReminderDuration(dur.getDays() + weeksToDays);
        teamEvent.setReminderDurationUnit(ReminderDurationUnit.DAYS);
      } else if (dur.getHours() != 0) {
        teamEvent.setReminderDuration(dur.getHours());
        teamEvent.setReminderDurationUnit(ReminderDurationUnit.HOURS);
      } else if (dur.getMinutes() != 0) {
        teamEvent.setReminderDuration(dur.getMinutes());
        teamEvent.setReminderDurationUnit(ReminderDurationUnit.MINUTES);
      }
    }
  }
  final RRule rule = (RRule) event.getProperty(Property.RRULE);
  if (rule != null) {
    teamEvent.setRecurrenceRule(rule.getValue());
  }
  final ExDate exDate = (ExDate) event.getProperty(Property.EXDATE);
  if (exDate != null) {
    teamEvent.setRecurrenceExDate(exDate.getValue());
  }
  return teamEvent;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:68,代码来源:TeamEventUtils.java


注:本文中的net.fortuna.ical4j.model.property.ExDate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。