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


Java VAlarm.getTrigger方法代码示例

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


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

示例1: getTriggerDates

import net.fortuna.ical4j.model.component.VAlarm; //导入方法依赖的package包/类
/**
 * Return the list of dates that an alarm will trigger.
 * @param alarm alarm component
 * @param parent parent compoennt (VEvent,VToDo)
 * @return dates that alarm is configured to trigger
 */
public static List<Date> getTriggerDates(VAlarm alarm, Component parent) {
    ArrayList<Date> dates = new ArrayList<Date>();
    Trigger trigger = alarm.getTrigger();
    if(trigger==null) {
        return dates;
    }
    
    Date initialTriggerDate = getTriggerDate(trigger, parent);
    if(initialTriggerDate==null) {
        return dates;
    }
    
    dates.add(initialTriggerDate);
    
    Duration dur = alarm.getDuration();
    if(dur==null) {
        return dates;
    }
    Repeat repeat = alarm.getRepeat(); 
    if(repeat==null) {
        return dates;
    }
    
    Date nextTriggerDate = initialTriggerDate;
    for(int i=0;i<repeat.getCount();i++) {
        nextTriggerDate = Dates.getInstance(dur.getDuration().getTime(nextTriggerDate), nextTriggerDate);
        dates.add(nextTriggerDate);
    }
    
    return dates;
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:38,代码来源:ICalendarUtils.java

示例2: AND

import net.fortuna.ical4j.model.component.VAlarm; //导入方法依赖的package包/类
/**
 * A VALARM component is said to overlap a given time range if the
    following condition holds:

       (start <= trigger-time) AND (end > trigger-time)

   A VALARM component can be defined such that it triggers repeatedly.
   Such a VALARM component is said to overlap a given time range if at
   least one of its triggers overlaps the time range.
   @param comps The component list.
   @param filter The time range filter.
   @return The result.
 */
        
private boolean evaluateVAlarmTimeRange(ComponentList comps, TimeRangeFilter filter) {
    
    // VALARAM must have parent VEVENT or VTODO
    Component parent = stack.peek();
    if(parent==null) {
        return false;
    }
   
    // See if trigger-time overlaps the time range for each VALARM
    for(Iterator<Component> it=comps.iterator();it.hasNext();) {
        VAlarm alarm = (VAlarm) it.next();
        Trigger trigger = alarm.getTrigger();
        if(trigger==null) {
            continue;
        }
        
        List<Date> triggerDates = ICalendarUtils.getTriggerDates(alarm, parent);
        
        for(Date triggerDate: triggerDates) {
            if(filter.getPeriod().getStart().compareTo(triggerDate)<=0 &&
               filter.getPeriod().getEnd().after(triggerDate)) {
               return true;
            }
        }
    }
    
    return false;
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:43,代码来源:CalendarFilterEvaluater.java

示例3: AND

import net.fortuna.ical4j.model.component.VAlarm; //导入方法依赖的package包/类
/**
 * A VALARM component is said to overlap a given time range if the
    following condition holds:

       (start <= trigger-time) AND (end > trigger-time)

   A VALARM component can be defined such that it triggers repeatedly.
   Such a VALARM component is said to overlap a given time range if at
   least one of its triggers overlaps the time range.
   @param comps The component list.
   @param filter The time range filter.
   @return The result.
 */
        
private boolean evaluateVAlarmTimeRange(ComponentList<? extends Component> comps, TimeRangeFilter filter) {
    
    // VALARAM must have parent VEVENT or VTODO
    Component parent = stack.peek();
    if(parent==null) {
        return false;
    }
   
    // See if trigger-time overlaps the time range for each VALARM
    for(Component component : comps) {
        if (!(component instanceof VAlarm)) {
            continue;
        }
        VAlarm alarm = (VAlarm) component;
        Trigger trigger = alarm.getTrigger();
        if(trigger==null) {
            continue;
        }
        
        List<Date> triggerDates = ICalendarUtils.getTriggerDates(alarm, parent);
        
        for(Date triggerDate: triggerDates) {
            if(filter.getPeriod().getStart().compareTo(triggerDate)<=0 &&
               filter.getPeriod().getEnd().after(triggerDate)) {
               return true;
            }
        }
    }
    
    return false;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:46,代码来源:CalendarFilterEvaluater.java

示例4: setCalendarAttributes

import net.fortuna.ical4j.model.component.VAlarm; //导入方法依赖的package包/类
/**
 * Sets calendar attributes.
 * @param note The note item.
 * @param event The event.
 */
private void setCalendarAttributes(NoteItem note, VEvent event) {
    
    // UID (only set if master)
    if(event.getUid()!=null && note.getModifies()==null) {
        note.setIcalUid(event.getUid().getValue());
    }
    
    // for now displayName is limited to 1024 chars
    if (event.getSummary() != null) {
        note.setDisplayName(StringUtils.substring(event.getSummary()
                .getValue(), 0, 1024));
    }

    if (event.getDescription() != null) {
        note.setBody(event.getDescription().getValue());
    }

    // look for DTSTAMP
    if(event.getDateStamp()!=null) {
        note.setClientModifiedDate(event.getDateStamp().getDate());
    }
    
    // look for absolute VALARM
    VAlarm va = ICalendarUtils.getDisplayAlarm(event);
    if (va != null && va.getTrigger()!=null) {
        Trigger trigger = va.getTrigger();
        Date reminderTime = trigger.getDateTime();
        if (reminderTime != null) {
            note.setReminderTime(reminderTime);
        }
    }

    // calculate triage status based on start date
    java.util.Date now =java.util.Calendar.getInstance().getTime();
    Date eventStartDate = event.getStartDate() != null && event.getStartDate().getDate() != null 
    		? event.getStartDate().getDate()
    		:new Date();
    boolean later = eventStartDate.after(now);
    int code = later ? TriageStatus.CODE_LATER : TriageStatus.CODE_DONE;
    
    TriageStatus triageStatus = note.getTriageStatus();
    
    // initialize TriageStatus if not present
    if (triageStatus == null) {
        triageStatus = TriageStatusUtil.initialize(entityFactory
                .createTriageStatus());
        note.setTriageStatus(triageStatus);
    }

    triageStatus.setCode(code);
    
    // check for X-OSAF-STARRED
    if ("TRUE".equals(ICalendarUtils.getXProperty(X_OSAF_STARRED, event))) {
        TaskStamp ts = StampUtils.getTaskStamp(note);
        if (ts == null) {
            note.addStamp(entityFactory.createTaskStamp());
        }
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:65,代码来源:EntityConverter.java


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