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


Java VEvent.getStartDate方法代码示例

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


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

示例1: getDuration

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Get the duration for an event.  If the DURATION property
 * exist, use that.  Else, calculate duration from DTSTART and
 * DTEND.
 * @param event The event.
 * @return duration for event
 */
public static Dur getDuration(VEvent event) {
    Duration duration = (Duration)
        event.getProperties().getProperty(Property.DURATION);
    if (duration != null) {
        return duration.getDuration();
    }
    DtStart dtstart = event.getStartDate();
    if (dtstart == null) {
        return null;
    }
    DtEnd dtend = (DtEnd) event.getProperties().getProperty(Property.DTEND);
    if (dtend == null) {
        return null;
    }
    return new Duration(dtstart.getDate(), dtend.getDate()).getDuration();
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:24,代码来源:ICalendarUtils.java

示例2: isEventValid

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
private static boolean isEventValid(VEvent event, ValidationConfig config){
    
    DtStart startDate = event.getStartDate();
    DtEnd endDate = event.getEndDate(true);
    if(startDate == null || 
        startDate.getDate() == null ||
        endDate != null && startDate.getDate().after(endDate.getDate())){
        
        return false;
    }
    
    
    for(PropertyValidator validator : values()){
        if(!validator.isValid(event, config)){
            return false; 
        }
    }
    
    return areTimeZoneIdsValid(event);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:21,代码来源:EventValidator.java

示例3: 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

示例4: getStartDate

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
public Date getStartDate() {
    VEvent event = getEvent();
    if(event==null) {
        return null;
    }
    
    DtStart dtStart = event.getStartDate();
    if (dtStart == null) {
        return null;
    }
    return dtStart.getDate();
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:13,代码来源:HibBaseEventStamp.java

示例5: getStartDate

import net.fortuna.ical4j.model.component.VEvent; //导入方法依赖的package包/类
/**
 * Gets start date.
 * @return date.
 */
public Date getStartDate() {
    VEvent event = getEvent();
    if (event==null) {
        return null;
    }
    
    DtStart dtStart = event.getStartDate();
    if (dtStart == null) {
        return null;
    }
    return dtStart.getDate();
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:17,代码来源:MockBaseEventStamp.java

示例6: setCalendarAttributes

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