本文整理汇总了Java中net.fortuna.ical4j.model.Calendar.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Calendar.getComponent方法的具体用法?Java Calendar.getComponent怎么用?Java Calendar.getComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.fortuna.ical4j.model.Calendar
的用法示例。
在下文中一共展示了Calendar.getComponent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCalendarFromNote
import net.fortuna.ical4j.model.Calendar; //导入方法依赖的package包/类
/**
* Gets calendar from note.
* @param note The note item.
* @return The calendar.
*/
protected Calendar getCalendarFromNote(NoteItem note) {
// Start with existing calendar if present
Calendar calendar = note.getTaskCalendar();
// otherwise, start with new calendar
if (calendar == null) {
calendar = ICalendarUtils.createBaseCalendar(new VToDo());
}
else {
// use copy when merging calendar with item properties
calendar = CalendarUtils.copyCalendar(calendar);
}
// merge in displayName,body
VToDo task = (VToDo) calendar.getComponent(Component.VTODO);
mergeCalendarProperties(task, note);
return calendar;
}
示例2: setCalendar
import net.fortuna.ical4j.model.Calendar; //导入方法依赖的package包/类
/**
* <p>
* Imports a calendar object containing a VAVAILABILITY.
* @param cal The calendar imported.
* @throws CosmoDavException - if something is wrong this exception is thrown.
* </p>
*/
public void setCalendar(Calendar cal) throws CosmoDavException {
AvailabilityItem availability = (AvailabilityItem) getItem();
availability.setAvailabilityCalendar(cal);
Component comp = cal.getComponent(ICalendarConstants.COMPONENT_VAVAILABLITY);
if (comp==null) {
throw new UnprocessableEntityException("VCALENDAR does not contain a VAVAILABILITY");
}
String val = null;
Property prop = comp.getProperty(Property.UID);
if (prop != null) {
val = prop.getValue();
}
if (StringUtils.isBlank(val)) {
throw new UnprocessableEntityException("VAVAILABILITY does not contain a UID");
}
availability.setIcalUid(val);
}
示例3: parseCalendartoAppointment
import net.fortuna.ical4j.model.Calendar; //导入方法依赖的package包/类
/**
* Updating Appointments which already exist, by parsing the Calendar. And updating etag.
* Doesn't work with complex Recurrences.
* Note: Hasn't been tested to acknowledge DST, timezones should acknowledge this.
*
* @param a Appointment to be updated.
* @param calendar iCalendar Representation.
* @param etag The ETag of the calendar.
* @return Updated Appointment.
*/
public Appointment parseCalendartoAppointment(Appointment a, Calendar calendar, String etag) {
if (calendar == null) {
return a;
}
CalendarComponent event = calendar.getComponent(Component.VEVENT);
if (event != null) {
a.setEtag(etag);
a = addVEventPropertiestoAppointment(a, event);
}
return a;
}
示例4: parseTimeZone
import net.fortuna.ical4j.model.Calendar; //导入方法依赖的package包/类
/**
* Parses the VTimezone Component of the given Calendar. If no, VTimezone component is found the
* User Timezone is used
*
* @param calendar Calendar to parse
* @param owner Owner of the Calendar
* @return Parsed TimeZone
*/
public TimeZone parseTimeZone(Calendar calendar, User owner) {
if (calendar != null) {
Component timezone = calendar.getComponent(Component.VTIMEZONE);
if (timezone != null) {
Property tzid = timezone.getProperty(Property.TZID);
if (tzid != null) {
return getTimeZone(tzid.getValue());
}
}
}
return getTimeZone(owner);
}
示例5: setCalendar
import net.fortuna.ical4j.model.Calendar; //导入方法依赖的package包/类
/**
* <p>
* Imports a calendar object containing a VFREEBUSY.
* </p>
* @return The calendar imported.
* @throws CosmoDavException - if something is wrong this exception is thrown.
*/
public void setCalendar(Calendar cal) throws CosmoDavException {
FreeBusyItem freeBusy = (FreeBusyItem) getItem();
VFreeBusy vfb = (VFreeBusy) cal.getComponent(Component.VFREEBUSY);
if (vfb==null) {
throw new UnprocessableEntityException("VCALENDAR does not contain a VFREEBUSY");
}
EntityConverter converter = new EntityConverter(getEntityFactory());
converter.convertFreeBusyCalendar(freeBusy, cal);
}
示例6: extract
import net.fortuna.ical4j.model.Calendar; //导入方法依赖的package包/类
/**
* Creates an instance of <code>VTimeZone</code> from an
* iCalendar string.
*
* The iCalendar string must include an enclosing VCALENDAR object
* and exactly one enclosed VTIMEZONE component. All components,
* properties and parameters are validated according to RFC 2445.
*
* @param ical the iCalendar string to parse
* @return the <code>VTimeZone</code> representing the extracted
* timezone, or <code>null</code> if the iCalendar string is
* <code>null</code>
* @throws CosmoDavException if the iCalendar string cannot be parsed or is
* not a valid iCalendar object containing a single VTIMEZONE component
*/
public static VTimeZone extract(String ical)
throws CosmoDavException {
Calendar calendar = extractInCalendar(ical);
if (calendar == null) {
return null;
}
return (VTimeZone) calendar.getComponent(Component.VTIMEZONE);
}