• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DateList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ICalDate

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * Constructs an <code>ICalDate</code> from an iCalendar date
 * list. Date lists cannot be anytime.
 * @param dates The date list.
 * @throws UnknownTimeZoneException - if something is wrong this exception is thrown.
 */
public ICalDate(DateList dates) throws UnknownTimeZoneException {
    value = dates.getType();
    tz = dates.getTimeZone();
    if (tz != null) {
        String origId = tz.getID();
        tz = tzTranslator.translateToOlsonTz(tz);
        if (tz == null) {
            throw new UnknownTimeZoneException(origId);
        }
        String id = tz.getVTimeZone().getProperties().
            getProperty(Property.TZID).getValue();
        tzid = new TzId(id);
    }
    text = dates.toString();
    this.dates = dates;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:23,代码来源:ICalDate.java


示例2: setRecurrenceDates

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


示例3: setExceptionDates

import net.fortuna.ical4j.model.DateList; //导入依赖的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


示例4: testParseDateList

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * Tests parse date list.
 * @throws Exception - if something is wrong this exception is thrown.
 */
@Test
public void testParseDateList() throws Exception {
    String str = ";VALUE=DATE:20021010,20021011,20021012";

    DateList dl = new ICalDate(str).getDateList();
    Assert.assertNotNull("null date list", dl);
    Assert.assertEquals("wrong number of dates", 3, dl.size());

    Assert.assertNull("not null timezone", dl.getTimeZone());

    Assert.assertEquals("not date", Value.DATE, dl.getType());

    Assert.assertEquals("incorrect date", "20021010", dl.get(0).toString());
    Assert.assertEquals("incorrect date", "20021011", dl.get(1).toString());
    Assert.assertEquals("incorrect date", "20021012", dl.get(2).toString());
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:21,代码来源:ICalDateTest.java


示例5: setRecurrenceDates

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


示例6: setExceptionDates

import net.fortuna.ical4j.model.DateList; //导入依赖的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


示例7: testExDates

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * Tests ex dates.
 * @throws Exception - if something is wrong this exception is thrown.
 */
@Test
public void testExDates() throws Exception {
    NoteItem master = new MockNoteItem();
    master.setDisplayName("displayName");
    master.setBody("body");
    EventStamp eventStamp = new MockEventStamp(master);
    
    eventStamp.setEventCalendar(getCalendar("recurring_with_exdates.ics"));
    
    DateList exdates = eventStamp.getExceptionDates();
    
    Assert.assertNotNull(exdates);
    Assert.assertTrue(2==exdates.size());
    Assert.assertNotNull(exdates.getTimeZone());
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:20,代码来源:EventStampTest.java


示例8: getRecurrenceExcludeDates

import net.fortuna.ical4j.model.DateList; //导入依赖的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


示例9: getRecurrenceIDList

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * Get a List of RECURRENCE-ID by recurrence dates and EXDATEs
 * 
 * @param recurDates
 * @param exDates
 * @param value     decide the format of RECURRENCE-ID
 * @return
 */
public ArrayList<String> getRecurrenceIDList(DateList recurDates, DateList exDates, Value value) throws ParseException{
    ArrayList<String> recurIdList= new ArrayList<String>();
    // Date
    if( value == Value.DATE ){
        fillRecurIDListbyDate(recurIdList, recurDates);            
    }
    // DateTime
    else{
        fillRecurIDListbyDateTime(recurIdList, recurDates);            
    }

    // remove the exdates
    if( exDates != null ){
        if( value == Value.DATE ){
            removeRecurIDListbyDate(recurIdList, exDates);   
        }
        else{
            removeRecurIDListbyDateTime(recurIdList, exDates);   
        }
    }
    
    return recurIdList;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:32,代码来源:EventResource.java


示例10: removeRecurIDListbyDate

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * @param recurIdList
 * @param iterator  The Data in Iterator should be Date or DateTime
 */
public void removeRecurIDListbyDate(ArrayList<String> recurIdList, DateList exDates) {
    String sDateTime;
    Iterator iterator = exDates.iterator();
    while (iterator.hasNext()) {
        Date exDate = (Date)iterator.next();
        if(exDate instanceof DateTime){
            ((DateTime) exDate).setUtc(true);
        }
        // exDates must have same type with value
        sDateTime = exDate.toString();
        int positionT = sDateTime.indexOf("T");
        if(positionT>0){
            sDateTime = sDateTime.substring(0, positionT);
        }
        recurIdList.remove(sDateTime);
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:22,代码来源:EventResource.java


示例11: recurTests

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
@Test
public void recurTests()
{
  final TimeZone timeZone = DateHelper.EUROPE_BERLIN;
  final Recur recur = new Recur();
  recur.setFrequency(ICal4JUtils.getCal4JFrequencyString(RecurrenceFrequency.WEEKLY));
  recur.setUntil(getDate("2013-01-31", timeZone));
  recur.setInterval(2);
  final DateList dateList = recur.getDates(getDate("2013-01-01", timeZone), getDate("2012-01-02", timeZone),
      getDate("2013-03-31", timeZone), Value.TIME);
  Assert.assertEquals(3, dateList.size());
  final DateFormat df = new SimpleDateFormat(DateFormats.ISO_TIMESTAMP_MINUTES);
  df.setTimeZone(timeZone);
  Assert.assertEquals("2013-01-01 00:00", df.format(dateList.get(0)));
  Assert.assertEquals("2013-01-15 00:00", df.format(dateList.get(1)));
  Assert.assertEquals("2013-01-29 00:00", df.format(dateList.get(2)));
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:18,代码来源:ICal4JUtilsTest.java


示例12: parseDates

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * Parses dates.
 * @param str The string.
 * @throws ParseException - if something is wrong this exception is thrown.
 */
private void parseDates(String str)
    throws ParseException {
    
    if (str.indexOf(',')==-1) {
        date = isDate() ? new Date(str) : new DateTime(str, tz);
        if(isDate() && tz != null) {
            throw new ParseException("DATE cannot have timezone",0);
        }
    }

    dates = isDate() ?
        new DateList(str, Value.DATE, tz) :
        new DateList(str, Value.DATE_TIME, tz);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:20,代码来源:ICalDate.java


示例13: isRecurring

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
public boolean isRecurring() {
   if(getRecurrenceRules().size()>0) {
       return true;
   }
   
   DateList rdates = getRecurrenceDates();
   
   return rdates!=null && rdates.size()>0;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:10,代码来源:HibBaseEventStamp.java


示例14: isRecurring

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * Is recurring.
 * @return boolean.
 */
public boolean isRecurring() {
   if(getRecurrenceRules().size()>0)
       return true;
   
   DateList rdates = getRecurrenceDates();
   
   return (rdates!=null && rdates.size()>0);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:13,代码来源:MockBaseEventStamp.java


示例15: getRecurrenceExcludeRule

import net.fortuna.ical4j.model.DateList; //导入依赖的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


示例16: fillRecurIDListbyDateTime

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * @param recurIdList
 * @param iterator      The Data in Iterator should be DateTime
 */
public void fillRecurIDListbyDateTime(ArrayList<String> recurIdList, DateList recurDates) {
    String sDateTime;
    Iterator iterator = recurDates.iterator();
    while (iterator.hasNext()) {
        DateTime dateTime = (DateTime)iterator.next();
        dateTime.setUtc(true);
        sDateTime = dateTime.toString();
        recurIdList.add(sDateTime);
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:15,代码来源:EventResource.java


示例17: fillRecurIDListbyDate

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * @param recurIdList
 * @param iterator  The Data in Iterator should be DateTime
 */
public void fillRecurIDListbyDate(ArrayList<String> recurIdList, DateList recurDates) {
    String sDateTime;
    Iterator iterator = recurDates.iterator();
    while (iterator.hasNext()) {
        DateTime dateTime = (DateTime)iterator.next();
        sDateTime = dateTime.toString();
        int positionT = sDateTime.indexOf("T");
        if(positionT>0){
            sDateTime = sDateTime.substring(0, positionT);
        }
        recurIdList.add(sDateTime);
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:18,代码来源:EventResource.java


示例18: removeRecurIDListbyDateTime

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * @param recurIdList
 * @param iterator  The Data in Iterator should be DateTime
 */
public void removeRecurIDListbyDateTime(ArrayList<String> recurIdList, DateList exDates) {
    String sDateTime;
    Iterator iterator = exDates.iterator();
    while (iterator.hasNext()) {
        DateTime exDate = (DateTime)iterator.next();
        exDate.setUtc(true);
        // exDates must have same type with value
        sDateTime = exDate.toString();
        recurIdList.remove(sDateTime);
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:16,代码来源:EventResource.java


示例19: createTestEvent

import net.fortuna.ical4j.model.DateList; //导入依赖的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


示例20: getRecurringDatesInPeriod

import net.fortuna.ical4j.model.DateList; //导入依赖的package包/类
/**
 * Get all recurrings of an event within the given period
 * 
 * @param periodStart
 * @param periodEnd
 * @param kEvent
 * @return list with <code>KalendarRecurEvent</code>
 */
public List<CalendarRecurEntry> getRecurringDatesInPeriod(final Date periodStart, final Date periodEnd) {
    final List<CalendarRecurEntry> lstDates = new ArrayList<CalendarRecurEntry>();
    final DateList recurDates = getRecurringsInPeriod(periodStart, periodEnd);
    if (recurDates == null) {
        return lstDates;
    }

    for (final Object obj : recurDates) {
        final net.fortuna.ical4j.model.Date date = (net.fortuna.ical4j.model.Date) obj;

        CalendarRecurEntry recurEvent;

        final java.util.Calendar eventStartCal = java.util.Calendar.getInstance();
        eventStartCal.clear();
        eventStartCal.setTime(getBegin());

        final java.util.Calendar eventEndCal = java.util.Calendar.getInstance();
        eventEndCal.clear();
        eventEndCal.setTime(getEnd());

        final java.util.Calendar recurStartCal = java.util.Calendar.getInstance();
        recurStartCal.clear();
        recurStartCal.setTimeInMillis(date.getTime());

        final long duration = getEnd().getTime() - getBegin().getTime();

        final java.util.Calendar beginCal = java.util.Calendar.getInstance();
        beginCal.clear();
        beginCal.set(recurStartCal.get(java.util.Calendar.YEAR), recurStartCal.get(java.util.Calendar.MONTH), recurStartCal.get(java.util.Calendar.DATE),
                eventStartCal.get(java.util.Calendar.HOUR_OF_DAY), eventStartCal.get(java.util.Calendar.MINUTE), eventStartCal.get(java.util.Calendar.SECOND));

        final java.util.Calendar endCal = java.util.Calendar.getInstance();
        endCal.clear();
        endCal.setTimeInMillis(beginCal.getTimeInMillis() + duration);
        if (getBegin().compareTo(beginCal.getTime()) == 0) {
            continue; // prevent doubled events
        }
        final Date recurrenceEnd = getRecurrenceEndDate();
        if (isAllDayEvent() && recurrenceEnd != null && recurStartCal.getTime().after(recurrenceEnd)) {
            continue; // workaround for ical4j-bug in all day events
        }
        recurEvent = new CalendarRecurEntry(getID(), getSubject(), new Date(beginCal.getTimeInMillis()), new Date(endCal.getTimeInMillis()));
        recurEvent.setSourceCalendarEntry(this);
        lstDates.add(recurEvent);
    }
    return lstDates;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:56,代码来源:CalendarEntry.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UserManager类代码示例发布时间:2022-05-23
下一篇:
Java IrishLowerCaseFilter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap