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


Java VEvent.getRecurrenceId方法代码示例

本文整理汇总了Java中net.fortuna.ical4j.model.component.VEvent.getRecurrenceId方法的典型用法代码示例。如果您正苦于以下问题:Java VEvent.getRecurrenceId方法的具体用法?Java VEvent.getRecurrenceId怎么用?Java VEvent.getRecurrenceId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.fortuna.ical4j.model.component.VEvent的用法示例。


在下文中一共展示了VEvent.getRecurrenceId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOcurrences

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Expand recurring event for given time-range.
 * @param calendar calendar containing recurring event and modifications
 * @param rangeStart expand start
 * @param rangeEnd expand end
 * @param timezone Optional timezone to use for floating dates.  If null, the
 *        system default is used.
 * @return InstanceList containing all occurences of recurring event during
 *         time range
 */
public InstanceList getOcurrences(Calendar calendar, Date rangeStart, Date rangeEnd, TimeZone timezone) {
    ComponentList vevents = calendar.getComponents().getComponents(
            Component.VEVENT);
    
    List<Component> exceptions = new ArrayList<Component>();
    Component masterComp = null;
    
    // get list of exceptions (VEVENT with RECURRENCEID)
    for (Iterator<VEvent> i = vevents.iterator(); i.hasNext();) {
        VEvent event = i.next();
        if (event.getRecurrenceId() != null) {
            exceptions.add(event);
        }
        else {
            masterComp = event; 
        }
        
    }
    
    return getOcurrences(masterComp, exceptions, rangeStart, rangeEnd, timezone);
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:32,代码来源:RecurrenceExpander.java

示例2: addToInstanceList

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
    * Adds to instance list.
    *
    * @param calendar  The calendar.
    * @param instances The instances.
    * @param start     The start.
    * @param end       The end.
    */
   private static void addToInstanceList(Calendar calendar,
                                         InstanceList instances, Date start, Date end) {
       ComponentList vevents = calendar.getComponents().getComponents(VEvent.VEVENT);
Iterator<VEvent> it = vevents.iterator();
       boolean addedMaster = false;
       while (it.hasNext()) {
           VEvent event = (VEvent)it.next();
           if (event.getRecurrenceId() == null) {
               addedMaster = true;
               instances.addComponent(event, start, end);
           } else {
               Assert.assertTrue(addedMaster);
               instances.addOverride(event, start, end);
           }
       }
   }
 
开发者ID:ksokol,项目名称:carldav,代码行数:25,代码来源:InstanceListTest.java

示例3: calculateRecurrenceRange

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Return start and end Date that represent the start of the first 
 * occurrence of a recurring component and the end of the last
 * occurence.  If the recurring component has no end(infinite recurring event),
 * then no end date will be returned.
 * @param calendar Calendar containing master and modification components
 * @return array containing start (located at index 0) and end (index 1) of
 *         recurring component.
 */
public Date[] calculateRecurrenceRange(Calendar calendar) {
    try{
        ComponentList<VEvent> vevents = calendar.getComponents().getComponents(Component.VEVENT);
        
        List<Component> exceptions = new ArrayList<Component>();
        Component masterComp = null;
        
        // get list of exceptions (VEVENT with RECURRENCEID)
        for (Iterator<VEvent> i = vevents.iterator(); i.hasNext();) {
            VEvent event = i.next();
            if (event.getRecurrenceId() != null) {
                exceptions.add(event);
            }
            else {
                masterComp = event;
            }
            
        }
        
        return calculateRecurrenceRange(masterComp, exceptions);
    } catch (Exception e){
        LOG.error("ERROR in calendar: " + calendar, e);
        throw e;
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:35,代码来源:RecurrenceExpander.java

示例4: getOcurrences

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Expand recurring event for given time-range.
 * @param calendar calendar containing recurring event and modifications
 * @param rangeStart expand start
 * @param rangeEnd expand end
 * @param timezone Optional timezone to use for floating dates.  If null, the
 *        system default is used.
 * @return InstanceList containing all occurences of recurring event during
 *         time range
 */
public InstanceList getOcurrences(Calendar calendar, Date rangeStart, Date rangeEnd, TimeZone timezone) {
    ComponentList<VEvent> vevents = calendar.getComponents().getComponents(Component.VEVENT);
    
    List<Component> exceptions = new ArrayList<Component>();
    Component masterComp = null;
    
    // get list of exceptions (VEVENT with RECURRENCEID)
    for (Iterator<VEvent> i = vevents.iterator(); i.hasNext();) {
        VEvent event = i.next();
        if (event.getRecurrenceId() != null) {
            exceptions.add(event);
        }
        else {
            masterComp = event; 
        }
        
    }
    
    return getOcurrences(masterComp, exceptions, rangeStart, rangeEnd, timezone);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:31,代码来源:RecurrenceExpander.java

示例5: filterCalendar

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
public void filterCalendar(Calendar calendar) {
   
    try {
        ComponentList<VEvent> events = calendar.getComponents(Component.VEVENT);
        for(VEvent event : events) {                 
            // fix VALUE=DATE-TIME instances
            fixDateTimeProperties(event);
            // fix EXDATEs
            if(event.getRecurrenceId()==null) {
                fixExDates(event);
            }
        }
    } catch (Exception e) {
        throw new CosmoException(e);
    } 
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:17,代码来源:ICal3ClientFilter.java

示例6: addToInstanceList

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
    * Adds to instance list.
    *
    * @param calendar  The calendar.
    * @param instances The instances.
    * @param start     The start.
    * @param end       The end.
    */
   private static void addToInstanceList(Calendar calendar,
                                         InstanceList instances, Date start, Date end) {
       ComponentList<VEvent> vevents = calendar.getComponents().getComponents(VEvent.VEVENT);
Iterator<VEvent> it = vevents.iterator();
       boolean addedMaster = false;
       while (it.hasNext()) {
           VEvent event = (VEvent)it.next();
           if (event.getRecurrenceId() == null) {
               addedMaster = true;
               instances.addComponent(event, start, end);
           } else {
               Assert.assertTrue(addedMaster);
               instances.addOverride(event, start, end);
           }
       }
   }
 
开发者ID:1and1,项目名称:cosmo,代码行数:25,代码来源:InstanceListTest.java

示例7: calculateRecurrenceRange

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Return start and end Date that represent the start of the first 
 * occurrence of a recurring component and the end of the last
 * occurence.  If the recurring component has no end(infinite recurring event),
 * then no end date will be returned.
 * @param calendar Calendar containing master and modification components
 * @return array containing start (located at index 0) and end (index 1) of
 *         recurring component.
 */
public Date[] calculateRecurrenceRange(Calendar calendar) {
    try{
        ComponentList vevents = calendar.getComponents().getComponents(
                Component.VEVENT);
        
        List<Component> exceptions = new ArrayList<Component>();
        Component masterComp = null;
        
        // get list of exceptions (VEVENT with RECURRENCEID)
        for (Iterator<VEvent> i = vevents.iterator(); i.hasNext();) {
            VEvent event = i.next();
            if (event.getRecurrenceId() != null) {
                exceptions.add(event);
            }
            else {
                masterComp = event;
            }
            
        }
        
        return calculateRecurrenceRange(masterComp, exceptions);
    } catch (Exception e){
        LOG.error("ERROR in calendar: " + calendar, e);
        throw e;
    }
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:36,代码来源:RecurrenceExpander.java

示例8: isOccurrence

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Determine if date is a valid occurence in recurring calendar component
 * @param calendar recurring calendar component
 * @param occurrence occurrence date
 * @return true if the occurrence date is a valid occurrence, otherwise false
 */
public boolean isOccurrence(Calendar calendar, Date occurrence) {
    java.util.Calendar cal = Dates.getCalendarInstance(occurrence);
    cal.setTime(occurrence);
   
    // Add a second or day (one unit forward) so we can set a range for
    // finding instances.  This is required because ical4j's Recur apis
    // only calculate recurring dates up until but not including the 
    // end date of the range.
    if(occurrence instanceof DateTime) {
        cal.add(java.util.Calendar.SECOND, 1);
    }
    else {
        cal.add(java.util.Calendar.DAY_OF_WEEK, 1);
    }
    
    Date rangeEnd = 
        org.unitedinternet.cosmo.calendar.util.Dates.getInstance(cal.getTime(), occurrence);
    
    TimeZone tz = null;
    
    for(Object obj : calendar.getComponents(Component.VEVENT)){
    	VEvent evt = (VEvent)obj;
    	if(evt.getRecurrenceId() == null && evt.getStartDate() != null){
    		tz = evt.getStartDate().getTimeZone();
    	}
    }
    InstanceList instances = getOcurrences(calendar, occurrence, rangeEnd, tz);
    
    for(Iterator<Instance> it = instances.values().iterator(); it.hasNext();) {
        Instance instance = it.next();
        if(instance.getRid().getTime()==occurrence.getTime()) {
            return true;
        }
    }
    
    return false;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:44,代码来源:RecurrenceExpander.java

示例9: createEvent

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Creates event.
 * @param uid The uid.
 * @param calendar The calendar.
 * @return The note item.
 */
protected NoteItem createEvent(String uid, Calendar calendar) {
    NoteItem master = new MockNoteItem();
    master.setUid(uid);
    EventStamp es = new MockEventStamp(master);
    master.addStamp(es);
    
    ComponentList<VEvent> vevents = calendar.getComponents().getComponents(Component.VEVENT);
    List<VEvent> exceptions = new ArrayList<VEvent>();        
    // get list of exceptions (VEVENT with RECURRENCEID)        
    for (VEvent event : vevents) {            
        if (event.getRecurrenceId() != null) {
            exceptions.add(event);
            NoteItem mod = new MockNoteItem();
            mod.setUid(new ModificationUidImpl(master,event.getRecurrenceId().getDate()).toString());
            mod.setModifies(master);
            master.addModification(mod);
            EventExceptionStamp ees = new MockEventExceptionStamp(mod);
            mod.addStamp(ees);
            ees.createCalendar();
            ees.setRecurrenceId(event.getRecurrenceId().getDate());
            ees.setStartDate(event.getStartDate().getDate());
            ees.setAnyTime(null);
        } 
    }
    
    
    for (VEvent ex: exceptions) {
        calendar.getComponents().remove(ex);
    }
    
    es.setEventCalendar(calendar);
    
    return master;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:41,代码来源:ThisAndFutureHelperTest.java

示例10: getEvent

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Gets event.
 * @param recurrenceId The recurrence id.
 * @param calendar The calendar.
 * @return The event.
 */
private VEvent getEvent(String recurrenceId, Calendar calendar) {
    ComponentList<VEvent> events = calendar.getComponents().getComponents(Component.VEVENT);
    for(VEvent event : events) {            
        if(event.getRecurrenceId()!=null && event.getRecurrenceId().getDate().toString().equals(recurrenceId))
            return event;
    }
    return null;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:15,代码来源:StandardContentServiceTest.java


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