本文整理汇总了Java中net.fortuna.ical4j.model.Calendar.VCALENDAR属性的典型用法代码示例。如果您正苦于以下问题:Java Calendar.VCALENDAR属性的具体用法?Java Calendar.VCALENDAR怎么用?Java Calendar.VCALENDAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.fortuna.ical4j.model.Calendar
的用法示例。
在下文中一共展示了Calendar.VCALENDAR属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MultigetHandler
public MultigetHandler(List<String> hrefs, boolean onlyEtag, String path, OmCalendar calendar, HttpClient client,
AppointmentDao appointmentDao, IcalUtils utils) {
super(path, calendar, client, appointmentDao, utils);
this.onlyEtag = onlyEtag;
if (hrefs == null || hrefs.isEmpty() || calendar.getSyncType() == SyncType.NONE) {
isMultigetDisabled = true;
} else {
DavPropertyNameSet properties = new DavPropertyNameSet();
properties.add(DavPropertyName.GETETAG);
CalendarData calendarData = null;
if (!onlyEtag) {
calendarData = new CalendarData();
}
CompFilter vcalendar = new CompFilter(Calendar.VCALENDAR);
vcalendar.addCompFilter(new CompFilter(Component.VEVENT));
query = new CalendarMultiget(properties, calendarData, false, false);
query.setHrefs(hrefs);
}
}
示例2: createFromXml
/**
* Returns an <code>OutputFilter</code> representing the given
* <code><C:calendar-data/>> element.
* @param cdata the given calendar data.
* @return output filter.
* @throws CosmoDavException - if something is wrong this exception is thrown.
*/
public OutputFilter createFromXml(Element cdata) throws CosmoDavException {
OutputFilter result = null;
Period expand = null;
Period limit = null;
String contentType = DomUtils.getAttribute(cdata, CarldavConstants.c(ATTR_CALDAV_CONTENT_TYPE));
if (contentType != null && ! contentType.equals(ICALENDAR_MEDIA_TYPE)) {
throw new UnsupportedCalendarDataException(contentType);
}
String version = DomUtils.getAttribute(cdata, CarldavConstants.c(ATTR_CALDAV_VERSION));
if (version != null && ! version.equals(ICALENDAR_VERSION)) {
throw new UnsupportedCalendarDataException();
}
// Look at each child element of calendar-data
for (ElementIterator iter = DomUtils.getChildren(cdata); iter.hasNext();) {
Element child = iter.nextElement();
if (ELEMENT_CALDAV_COMP.equals(child.getLocalName())) {
// At the top-level of calendar-data there should only be one
// <comp> element as VCALENDAR components are the only top-level
// components allowed in iCalendar data
if (result != null) {
throw new UnsupportedOperationException("only one top-level component supported");
}
// Get required name attribute and verify it is VCALENDAR
String name = DomUtils.getAttribute(child, ATTR_CALDAV_NAME);
if (!Calendar.VCALENDAR.equals(name)) {
throw new UnsupportedOperationException("only top-level comp name " + Calendar.VCALENDAR + " supported");
}
// Now parse filter item
result = parseCalendarDataComp(child);
} else if (ELEMENT_CALDAV_EXPAND.equals(child.getLocalName())) {
expand = parsePeriod(child);
} else if (ELEMENT_CALDAV_LIMIT_RECURRENCE_SET.equals(child.getLocalName())) {
limit = parsePeriod(child);
}
}
// Now add any limit/expand options, creating a filter if one is not
// already present
if (result == null && (expand != null || limit != null)) {
result = new OutputFilter("VCALENDAR");
result.setAllSubComponents();
result.setAllProperties();
}
if (expand != null) {
result.setExpand(expand);
}
if (limit != null) {
result.setLimit(limit);
}
return result;
}
示例3: createQueryFilters
private CalendarFilter[] createQueryFilters(CollectionItem collection, Period period) {
DateTime start = period.getStart();
DateTime end = period.getEnd();
CalendarFilter[] filters = new CalendarFilter[2];
TimeZone tz = null;
// Create calendar-filter elements designed to match
// VEVENTs/VFREEBUSYs within the specified time range.
//
// <C:filter>
// <C:comp-filter name="VCALENDAR">
// <C:comp-filter name="VEVENT">
// <C:time-range start="20051124T000000Z"
// end="20051125T000000Z"/>
// </C:comp-filter>
// <C:comp-filter name="VFREEBUSY">
// <C:time-range start="20051124T000000Z"
// end="20051125T000000Z"/>
// </C:comp-filter>
// </C:comp-filter>
// </C:filter>
// If the calendar collection has a timezone attribute,
// then use that to convert floating date/times to UTC
CalendarCollectionStamp ccs = StampUtils.getCalendarCollectionStamp(collection);
if (ccs!=null) {
tz = ccs.getTimezone();
}
ComponentFilter eventFilter = new ComponentFilter(Component.VEVENT);
eventFilter.setTimeRangeFilter(new TimeRangeFilter(start, end));
if(tz!=null) {
eventFilter.getTimeRangeFilter().setTimezone(tz.getVTimeZone());
}
ComponentFilter calFilter = new ComponentFilter(Calendar.VCALENDAR);
calFilter.getComponentFilters().add(eventFilter);
CalendarFilter filter = new CalendarFilter();
filter.setFilter(calFilter);
filters[0] = filter;
ComponentFilter freebusyFilter = new ComponentFilter(
Component.VFREEBUSY);
freebusyFilter.setTimeRangeFilter(new TimeRangeFilter(start, end));
if(tz!=null) {
freebusyFilter.getTimeRangeFilter().setTimezone(tz.getVTimeZone());
}
calFilter = new ComponentFilter(Calendar.VCALENDAR);
calFilter.getComponentFilters().add(freebusyFilter);
filter = new CalendarFilter();
filter.setFilter(calFilter);
filters[1] = filter;
return filters;
}