本文整理汇总了Java中net.fortuna.ical4j.model.Component类的典型用法代码示例。如果您正苦于以下问题:Java Component类的具体用法?Java Component怎么用?Java Component使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Component类属于net.fortuna.ical4j.model包,在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWorkEffortServiceMap
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
protected static void setWorkEffortServiceMap(Component component, Map<String, Object> serviceMap) {
PropertyList propertyList = component.getProperties();
setMapElement(serviceMap, "scopeEnumId", fromClazz(propertyList));
setMapElement(serviceMap, "description", fromDescription(propertyList));
setMapElement(serviceMap, "locationDesc", fromLocation(propertyList));
setMapElement(serviceMap, "priority", fromPriority(propertyList));
setMapElement(serviceMap, "currentStatusId", fromStatus(propertyList));
setMapElement(serviceMap, "workEffortName", fromSummary(propertyList));
setMapElement(serviceMap, "universalId", fromUid(propertyList));
// Set some fields to null so calendar clients can revert changes
serviceMap.put("estimatedStartDate", null);
serviceMap.put("estimatedCompletionDate", null);
serviceMap.put("estimatedMilliSeconds", null);
serviceMap.put("lastModifiedDate", null);
serviceMap.put("actualCompletionDate", null);
serviceMap.put("percentComplete", null);
setMapElement(serviceMap, "estimatedStartDate", fromDtStart(propertyList));
setMapElement(serviceMap, "estimatedMilliSeconds", fromDuration(propertyList));
setMapElement(serviceMap, "lastModifiedDate", fromLastModified(propertyList));
if ("VTODO".equals(component.getName())) {
setMapElement(serviceMap, "actualCompletionDate", fromCompleted(propertyList));
setMapElement(serviceMap, "percentComplete", fromPercentComplete(propertyList));
} else {
setMapElement(serviceMap, "estimatedCompletionDate", fromDtEnd(propertyList));
}
}
示例2: storeWorkEffort
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
protected static ResponseProperties storeWorkEffort(Component component, Map<String, Object> context) throws GenericEntityException, GenericServiceException {
PropertyList propertyList = component.getProperties();
String workEffortId = fromXProperty(propertyList, workEffortIdXPropName);
Delegator delegator = (Delegator) context.get("delegator");
GenericValue workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne();
if (workEffort == null) {
return ICalWorker.createNotFoundResponse(null);
}
if (!hasPermission(workEffortId, "UPDATE", context)) {
return null;
}
Map<String, Object> serviceMap = FastMap.newInstance();
serviceMap.put("workEffortId", workEffortId);
setWorkEffortServiceMap(component, serviceMap);
invokeService("updateWorkEffort", serviceMap, context);
return storePartyAssignments(workEffortId, component, context);
}
示例3: ReadCalendarFiles
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
public ReadCalendarFiles(String filePath) throws IOException, ParserException {
Map<String, String> calendarEntry = null;
FileInputStream fin = new FileInputStream(filePath);
CalendarBuilder builder = new CalendarBuilder();
net.fortuna.ical4j.model.Calendar calendar = builder.build(fin);
for (Iterator i = calendar.getComponents().iterator(); i.hasNext(); ) {
Component component = (Component) i.next();
if (component.getName().equalsIgnoreCase("VEVENT")) {
calendarEntry = new HashMap<>();
for (Iterator j = component.getProperties().iterator(); j.hasNext(); ) {
net.fortuna.ical4j.model.Property property = (Property) j.next();
calendarEntry.put(property.getName(), property.getValue());
}
calendarEntries.add(calendarEntry);
}
}
}
示例4: parseCalendartoAppointments
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Parses a Calendar with multiple VEvents into Appointments
*
* @param calendar Calendar to Parse
* @param ownerId Owner of the Appointments
* @return <code>List</code> of Appointments
*/
public List<Appointment> parseCalendartoAppointments(Calendar calendar, Long ownerId) {
List<Appointment> appointments = new ArrayList<>();
ComponentList<CalendarComponent> events = calendar.getComponents(Component.VEVENT);
User owner = userDao.get(ownerId);
for (CalendarComponent event : events) {
Appointment a = new Appointment();
a.setOwner(owner);
a.setDeleted(false);
a.setRoom(createDefaultRoom());
a.setReminder(Appointment.Reminder.none);
a = addVEventPropertiestoAppointment(a, event);
appointments.add(a);
}
return appointments;
}
示例5: MultigetHandler
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
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);
}
}
示例6: getCalendarFilter
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Gets calendar filter.
* @param esf event stamp filter.
* @return calendar filter.
*/
private CalendarFilter getCalendarFilter(EventStampFilter esf) {
ComponentFilter eventFilter = new ComponentFilter(Component.VEVENT);
eventFilter.setTimeRangeFilter(new TimeRangeFilter(esf.getPeriod().getStart(), esf.getPeriod().getEnd()));
if (esf.getTimezone() != null) {
eventFilter.getTimeRangeFilter().setTimezone(esf.getTimezone().getVTimeZone());
}
ComponentFilter calFilter = new ComponentFilter(
net.fortuna.ical4j.model.Calendar.VCALENDAR);
calFilter.getComponentFilters().add(eventFilter);
CalendarFilter filter = new CalendarFilter();
filter.setFilter(calFilter);
return filter;
}
示例7: getOcurrences
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Expand recurring event for given time-range.
* @param calendar calendar containing recurring event and modifications
* @param rangeStart expand start
* @param rangeEnd expand end
* @param timezone Optional timezone to use for floating dates. If null, the
* system default is used.
* @return InstanceList containing all occurences of recurring event during
* time range
*/
public InstanceList getOcurrences(Calendar calendar, Date rangeStart, Date rangeEnd, TimeZone timezone) {
ComponentList vevents = calendar.getComponents().getComponents(
Component.VEVENT);
List<Component> exceptions = new ArrayList<Component>();
Component masterComp = null;
// get list of exceptions (VEVENT with RECURRENCEID)
for (Iterator<VEvent> i = vevents.iterator(); i.hasNext();) {
VEvent event = i.next();
if (event.getRecurrenceId() != null) {
exceptions.add(event);
}
else {
masterComp = event;
}
}
return getOcurrences(masterComp, exceptions, rangeStart, rangeEnd, timezone);
}
示例8: validateName
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
private void validateName(Element element) throws ParseException {
name = DomUtils.getAttribute(element, ATTR_CALDAV_NAME);
if (name == null) {
throw new ParseException(
"CALDAV:comp-filter a calendar component name (e.g., \"VEVENT\") is required",
-1);
}
if (!(name.equals(Calendar.VCALENDAR)
|| CalendarUtils.isSupportedComponent(name)
|| name.equals(Component.VALARM)
|| name.equals(Component.VTIMEZONE))) {
throw new ParseException(name + " is not a supported iCalendar component", -1);
}
}
示例9: storeWorkEffort
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
protected static ResponseProperties storeWorkEffort(Component component, Map<String, Object> context) throws GenericEntityException, GenericServiceException {
PropertyList propertyList = component.getProperties();
String workEffortId = fromXProperty(propertyList, workEffortIdXPropName);
Delegator delegator = (Delegator) context.get("delegator");
GenericValue workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false);
if (workEffort == null) {
return ICalWorker.createNotFoundResponse(null);
}
if (!hasPermission(workEffortId, "UPDATE", context)) {
return null;
}
Map<String, Object> serviceMap = FastMap.newInstance();
serviceMap.put("workEffortId", workEffortId);
setWorkEffortServiceMap(component, serviceMap);
invokeService("updateWorkEffort", serviceMap, context);
return storePartyAssignments(workEffortId, component, context);
}
示例10: evaluate
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Evaluates.
* @param comps The component list.
* @param filter The time range filter.
* @return the result.
*/
private boolean evaluate(ComponentList comps, TimeRangeFilter filter) {
Component comp = (Component) comps.get(0);
if(comp instanceof VEvent) {
return evaluateVEventTimeRange(comps, filter);
}
else if(comp instanceof VToDo) {
return evaulateVToDoTimeRange(comps, filter);
}
else if(comp instanceof VJournal) {
return evaluateVJournalTimeRange((VJournal) comp, filter);
}
else if(comp instanceof VAlarm) {
return evaluateVAlarmTimeRange(comps, filter);
}
else {
return false;
}
}
示例11: calculateRecurrenceRange
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Return start and end Date that represent the start of the first
* occurrence of a recurring component and the end of the last
* occurence. If the recurring component has no end(infinite recurring event),
* then no end date will be returned.
* @param calendar Calendar containing master and modification components
* @return array containing start (located at index 0) and end (index 1) of
* recurring component.
*/
public Date[] calculateRecurrenceRange(Calendar calendar) {
try{
ComponentList<VEvent> vevents = calendar.getComponents().getComponents(Component.VEVENT);
List<Component> exceptions = new ArrayList<Component>();
Component masterComp = null;
// get list of exceptions (VEVENT with RECURRENCEID)
for (Iterator<VEvent> i = vevents.iterator(); i.hasNext();) {
VEvent event = i.next();
if (event.getRecurrenceId() != null) {
exceptions.add(event);
}
else {
masterComp = event;
}
}
return calculateRecurrenceRange(masterComp, exceptions);
} catch (Exception e){
LOG.error("ERROR in calendar: " + calendar, e);
throw e;
}
}
示例12: getOcurrences
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Expand recurring event for given time-range.
* @param calendar calendar containing recurring event and modifications
* @param rangeStart expand start
* @param rangeEnd expand end
* @param timezone Optional timezone to use for floating dates. If null, the
* system default is used.
* @return InstanceList containing all occurences of recurring event during
* time range
*/
public InstanceList getOcurrences(Calendar calendar, Date rangeStart, Date rangeEnd, TimeZone timezone) {
ComponentList<VEvent> vevents = calendar.getComponents().getComponents(Component.VEVENT);
List<Component> exceptions = new ArrayList<Component>();
Component masterComp = null;
// get list of exceptions (VEVENT with RECURRENCEID)
for (Iterator<VEvent> i = vevents.iterator(); i.hasNext();) {
VEvent event = i.next();
if (event.getRecurrenceId() != null) {
exceptions.add(event);
}
else {
masterComp = event;
}
}
return getOcurrences(masterComp, exceptions, rangeStart, rangeEnd, timezone);
}
示例13: getDisplayAlarm
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Find and return the first DISPLAY VALARM in a comoponent
* @param component VEVENT or VTODO
* @return first DISPLAY VALARM, null if there is none
*/
public static VAlarm getDisplayAlarm(Component component) {
ComponentList<VAlarm> alarms = null;
if(component instanceof VEvent) {
alarms = ((VEvent) component).getAlarms();
}
else if(component instanceof VToDo) {
alarms = ((VToDo) component).getAlarms();
}
if(alarms==null || alarms.size()==0) {
return null;
}
for(Iterator<VAlarm> it = alarms.iterator();it.hasNext();) {
VAlarm alarm = it.next();
if(Action.DISPLAY.equals(alarm.getAction())) {
return alarm;
}
}
return null;
}
示例14: evaluate
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Evaluates.
* @param comps The component list.
* @param filter The time range filter.
* @return the result.
*/
private boolean evaluate(ComponentList<? extends Component> comps, TimeRangeFilter filter) {
Component comp = (Component) comps.get(0);
if(comp instanceof VEvent) {
return evaluateVEventTimeRange(comps, filter);
}
else if(comp instanceof VFreeBusy) {
return evaulateVFreeBusyTimeRange((VFreeBusy) comp, filter);
}
else if(comp instanceof VToDo) {
return evaulateVToDoTimeRange(comps, filter);
}
else if(comp instanceof VJournal) {
return evaluateVJournalTimeRange((VJournal) comp, filter);
}
else if(comp instanceof VAlarm) {
return evaluateVAlarmTimeRange(comps, filter);
}
else {
return false;
}
}
示例15: testSubComponent
import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
* Test subcomponent.
* @param subcomp The component.
* @return The result.
*/
public boolean testSubComponent(Component subcomp) {
if (allSubComponents) {
return true;
}
if (subComponents == null) {
return false;
}
if (subComponents.containsKey(subcomp.getName().toUpperCase(CosmoConstants.LANGUAGE_LOCALE))) {
return true;
}
return false;
}