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


Java DtStart类代码示例

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


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

示例1: createCalendar

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
public static Calendar createCalendar(CalDavEvent calDavEvent, DateTimeZone timeZone) {
    TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
    TimeZone timezone = registry.getTimeZone(timeZone.getID());

    Calendar calendar = new Calendar();
    calendar.getProperties().add(Version.VERSION_2_0);
    calendar.getProperties().add(new ProdId("openHAB"));
    VEvent vEvent = new VEvent();
    vEvent.getProperties().add(new Summary(calDavEvent.getName()));
    vEvent.getProperties().add(new Description(calDavEvent.getContent()));
    final DtStart dtStart = new DtStart(new net.fortuna.ical4j.model.DateTime(calDavEvent.getStart().toDate()));
    dtStart.setTimeZone(timezone);
    vEvent.getProperties().add(dtStart);
    final DtEnd dtEnd = new DtEnd(new net.fortuna.ical4j.model.DateTime(calDavEvent.getEnd().toDate()));
    dtEnd.setTimeZone(timezone);
    vEvent.getProperties().add(dtEnd);
    vEvent.getProperties().add(new Uid(calDavEvent.getId()));
    vEvent.getProperties().add(Clazz.PUBLIC);
    vEvent.getProperties()
            .add(new LastModified(new net.fortuna.ical4j.model.DateTime(calDavEvent.getLastChanged().toDate())));
    calendar.getComponents().add(vEvent);

    return calendar;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:25,代码来源:Util.java

示例2: evaluateVJournalTimeRange

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
/**
 * Evaluates VJournal time range.
 * @param journal The VJournal.
 * @param filter The time range filter.
 * @return The result.
 */
private boolean evaluateVJournalTimeRange(VJournal journal, TimeRangeFilter filter) {
    DtStart start = journal.getStartDate();
  
    if(start==null) {
        return false;
    }
    
    InstanceList instances = new InstanceList();
    if (filter.getTimezone() != null) {
        instances.setTimezone(new TimeZone(filter.getTimezone()));
    }
    instances.addComponent(journal, filter.getPeriod().getStart(),
            filter.getPeriod().getEnd());
    return instances.size() > 0;
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:22,代码来源:CalendarFilterEvaluater.java

示例3: getDuration

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

示例4: setAnyTime

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
public void setAnyTime(Boolean isAnyTime) {
    DtStart dtStart = getEvent().getStartDate();
    if (dtStart == null) {
        throw new IllegalStateException("event has no start date");
    }
    Parameter parameter = dtStart.getParameters().getParameter(
            PARAM_X_OSAF_ANYTIME);

    // add X-OSAF-ANYTIME if it doesn't exist
    if (parameter == null && Boolean.TRUE.equals(isAnyTime)) {
        dtStart.getParameters().add(getAnyTimeXParam());
        return;
    }

    // if it exists, update based on isAnyTime
    if (parameter != null) {
        dtStart.getParameters().remove(parameter);
        if (Boolean.TRUE.equals(isAnyTime)) {
            dtStart.getParameters().add(getAnyTimeXParam());
        }
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:23,代码来源:HibBaseEventStamp.java

示例5: setAnyTime

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
/**
 * Toggle the event exception anytime parameter.
 * @param isAnyTime True if the event occurs anytime<br/>
 *                  False if the event does not occur anytime</br>
 *                  null if the event should inherit the anyTime
 *                  attribute of the master event.
 */
@Override
public void setAnyTime(Boolean isAnyTime) {
    // Interpret null as "missing" anyTime, meaning inherited from master
    if(isAnyTime==null) {
        DtStart dtStart = getEvent().getStartDate();
        if (dtStart == null) {
            throw new IllegalStateException("event has no start date");
        }
        Parameter parameter = dtStart.getParameters().getParameter(
                PARAM_X_OSAF_ANYTIME);
        if(parameter!=null) {
            dtStart.getParameters().remove(parameter);
        }
        
        // "missing" anyTime is represented as X-OSAF-ANYTIME=MISSING
        dtStart.getParameters().add(getInheritedAnyTimeXParam());
    } else {
        super.setAnyTime(isAnyTime);
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:28,代码来源:HibEventExceptionStamp.java

示例6: isAnyTime

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
/**
 * Is the event exception marked as anytime.
 * @return True if the event is an anytime event<br/>
 *         False if it is not an anytime event<br/>
 *         null if the anyTime attribute is "missing", ie inherited
 *         from the master event.
 */
@Override
public Boolean isAnyTime() {
    DtStart dtStart = getEvent().getStartDate();
    if (dtStart == null) {
        return Boolean.FALSE;
    }
    Parameter parameter = dtStart.getParameters()
        .getParameter(PARAM_X_OSAF_ANYTIME);
    if (parameter == null) {
        return Boolean.FALSE;
    }
 
    // return null for "missing" anyTime
    if(!VALUE_MISSING.equals(parameter.getValue())) {
        return Boolean.valueOf(VALUE_TRUE.equals(parameter.getValue()));
    }
    
    return Boolean.FALSE;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:27,代码来源:HibEventExceptionStamp.java

示例7: isEventValid

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

示例8: setAnyTime

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
/**
 * Sets any time.
 * @param isAnyTime Boolean.
 */
@Override
public void setAnyTime(Boolean isAnyTime) {
    // Interpret null as "missing" anyTime, meaning inherited from master
    if(isAnyTime==null) {
        DtStart dtStart = getEvent().getStartDate();
        if (dtStart == null) {
            throw new IllegalStateException("event has no start date");
        }
        Parameter parameter = dtStart.getParameters().getParameter(
                PARAM_X_OSAF_ANYTIME);
        if (parameter != null) {
            dtStart.getParameters().remove(parameter);
        }
        
        // "missing" anyTime is represented as X-OSAF-ANYTIME=MISSING
        dtStart.getParameters().add(getInheritedAnyTimeXParam());
    } else {
        super.setAnyTime(isAnyTime);
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:25,代码来源:MockEventExceptionStamp.java

示例9: isAnyTime

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
/**
 * Is any time.
 * @return boolean.
 */
@Override
public Boolean isAnyTime() {
    DtStart dtStart = getEvent().getStartDate();
    if (dtStart == null) {
        return Boolean.FALSE;
    }
    Parameter parameter = dtStart.getParameters()
        .getParameter(PARAM_X_OSAF_ANYTIME);
    if (parameter == null) {
        return Boolean.FALSE;
    }
 
    // return null for "missing" anyTime
    if (VALUE_MISSING.equals(parameter.getValue())) {
        return null;
    }

    return Boolean.valueOf(VALUE_TRUE.equals(parameter.getValue()));
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:24,代码来源:MockEventExceptionStamp.java

示例10: setAnyTime

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
/**
 * Sets any time.
 * @param isAnyTime isAnyTime.
 */
public void setAnyTime(Boolean isAnyTime) {
    DtStart dtStart = getEvent().getStartDate();
    if (dtStart == null) {
        throw new IllegalStateException("event has no start date");
    }
    Parameter parameter = dtStart.getParameters().getParameter(
            PARAM_X_OSAF_ANYTIME);

    // add X-OSAF-ANYTIME if it doesn't exist
    if (parameter == null && Boolean.TRUE.equals(isAnyTime)) {
        dtStart.getParameters().add(getAnyTimeXParam());
        return;
    }

    // if it exists, update based on isAnyTime
    if (parameter != null) {
        dtStart.getParameters().remove(parameter);
        if (Boolean.TRUE.equals(isAnyTime)) {   
            dtStart.getParameters().add(getAnyTimeXParam());
        }
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:27,代码来源:MockBaseEventStamp.java

示例11: testCreateContentThrowsExceptionForInvalidDates

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
@Test(expected=IllegalArgumentException.class)
public void testCreateContentThrowsExceptionForInvalidDates() throws Exception {
    User user = testHelper.makeDummyUser();
    CollectionItem rootCollection = contentDao.createRootItem(user);

    NoteItem noteItem = new MockNoteItem();
    noteItem.getAttributeValue("");
    noteItem.setName("foo");
    noteItem.setOwner(user);
    
    Calendar c = new Calendar();
    VEvent e = new VEvent();
    e.getProperties().add(new DtStart("20131010T101010Z"));
    e.getProperties().add(new DtEnd("20131010T091010Z"));
    
    c.getComponents().add(e);
    MockEventStamp mockEventStamp = new MockEventStamp();
    mockEventStamp.setEventCalendar(c);
    noteItem.addStamp(mockEventStamp);
    
    service.createContent(rootCollection, noteItem);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:23,代码来源:StandardContentServiceTest.java

示例12: testUpdateCollectionFailsForEventsWithInvalidDates

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
@Test(expected=IllegalArgumentException.class)
public void testUpdateCollectionFailsForEventsWithInvalidDates() throws Exception {
    User user = testHelper.makeDummyUser();
    CollectionItem rootCollection = contentDao.createRootItem(user);

    NoteItem noteItem = new MockNoteItem();
    noteItem.getAttributeValue("");
    noteItem.setName("foo");
    noteItem.setOwner(user);
    
    Calendar c = new Calendar();
    VEvent e = new VEvent();
    e.getProperties().add(new DtStart("20131010T101010Z"));
    e.getProperties().add(new DtEnd("20131010T091010Z"));
    
    c.getComponents().add(e);
    MockEventStamp mockEventStamp = new MockEventStamp();
    mockEventStamp.setEventCalendar(c);
    noteItem.addStamp(mockEventStamp);
    
    service.updateCollection(rootCollection, Collections.singleton((Item)noteItem));
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:23,代码来源:StandardContentServiceTest.java

示例13: fromDtStart

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
protected static Timestamp fromDtStart(PropertyList propertyList) {
    DtStart iCalObj = (DtStart) propertyList.getProperty(DtStart.DTSTART);
    if (iCalObj == null) {
        return null;
    }
    Date date = iCalObj.getDate();
    return new Timestamp(date.getTime());
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:9,代码来源:ICalConverter.java

示例14: createEventPropertyList

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
private PropertyList createEventPropertyList() {
    PropertyList propertyList = new PropertyList();

    DtStart dtStart = new DtStart(new Date(event.getEventStartDate()));
    Duration duration = new Duration(new Dur(0, 1, 0, 0));

    propertyList.add(dtStart);
    propertyList.add(createRepeatRule(event));
    propertyList.add(duration);

    return propertyList;
}
 
开发者ID:memfis19,项目名称:Cadar,代码行数:13,代码来源:EventComponentCreator.java

示例15: getStartDate

import net.fortuna.ical4j.model.property.DtStart; //导入依赖的package包/类
/**
 * Gets start date.
 * @param comp The component.
 * @return The date.
 */
private Date getStartDate(Component comp) {
    final DtStart dtStart = ICalendarUtils.getStartDate(comp);
    if(dtStart != null) {
        return dtStart.getDate();
    }
    return null;
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:13,代码来源:RecurrenceExpander.java


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