• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Component类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Component类属于net.fortuna.ical4j.model包,在下文中一共展示了Component类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:27,代码来源:ICalConverter.java


示例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);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:ICalConverter.java


示例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);
    }
  }
}
 
开发者ID:mark-watson,项目名称:power-java,代码行数:18,代码来源:ReadCalendarFiles.java


示例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;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:24,代码来源:IcalUtils.java


示例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);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:22,代码来源:MultigetHandler.java


示例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;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:22,代码来源:ItemFilterEvaluater.java


示例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);
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:32,代码来源:RecurrenceExpander.java


示例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);
    }
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:17,代码来源:ComponentFilter.java


示例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);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:18,代码来源:ICalConverter.java


示例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;
    }
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:27,代码来源:CalendarFilterEvaluater.java


示例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;
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:35,代码来源:RecurrenceExpander.java


示例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);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:31,代码来源:RecurrenceExpander.java


示例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;   
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:29,代码来源:ICalendarUtils.java


示例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;
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:30,代码来源:CalendarFilterEvaluater.java


示例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;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:21,代码来源:OutputFilter.java


示例16: convertCalendar

import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
 * Converts a single calendar containing many different
 * components and component types into a set of
 * {@link ICalendarItem}.
 * 
 * @param calendar calendar containing any number and type
 *        of calendar components
 * @return set of ICalendarItems
 */
public Set<ICalendarItem> convertCalendar(Calendar calendar) {
    Set<ICalendarItem> items = new LinkedHashSet<ICalendarItem>();
    for(CalendarContext cc: splitCalendar(calendar)) {
        if(cc.type.equals(Component.VEVENT)) {
            items.addAll(convertEventCalendar(cc.calendar));
        }
        else if(cc.type.equals(Component.VTODO)) {
            items.add(convertTaskCalendar(cc.calendar));
        }
        else if(cc.type.equals(Component.VJOURNAL)) {
            items.add(convertJournalCalendar(cc.calendar));
        }
        else if(cc.type.equals(Component.VFREEBUSY)) {
            items.add(convertFreeBusyCalendar(cc.calendar));
        }
    }
    
    return items;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:29,代码来源:EntityConverter.java


示例17: getCalendarFromNote

import net.fortuna.ical4j.model.Component; //导入依赖的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;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:25,代码来源:EntityConverter.java


示例18: compactTimezones

import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
 * Compact timezones.
 * @param calendar The calendar.
 */
private void compactTimezones(Calendar calendar) {
    
    if (calendar==null) {
        return;
    }

    // Get list of timezones in master calendar and remove all timezone
    // definitions that are in the registry.  The idea is to not store
    // extra data.  Instead, the timezones will be added to the calendar
    // by the getCalendar() api.
    ComponentList<VTimeZone> timezones = calendar.getComponents(Component.VTIMEZONE);
    List<VTimeZone> toRemove = new ArrayList<>();
    for(VTimeZone vtz : timezones) {
        String tzid = vtz.getTimeZoneId().getValue();
        TimeZone tz = TIMEZONE_REGISTRY.getTimeZone(tzid);
        //  Remove timezone iff it matches the one in the registry
        if(tz!=null && vtz.equals(tz.getVTimeZone())) {
            toRemove.add(vtz);
        }
    }

    // remove known timezones from master calendar
    calendar.getComponents().removeAll(toRemove);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:29,代码来源:EntityConverter.java


示例19: updateNoteModification

import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
/**
 * Updates note modification.
 * @param noteMod The note item modified.
 * @param event The event.
 */
private void updateNoteModification(NoteItem noteMod,
                                    VEvent event) {
    EventExceptionStamp exceptionStamp =
        StampUtils.getEventExceptionStamp(noteMod);
    exceptionStamp.setExceptionEvent(event);
    
    // copy VTIMEZONEs to front if present
    ComponentList<VTimeZone> vtimezones = exceptionStamp.getMasterStamp()
            .getEventCalendar().getComponents(Component.VTIMEZONE);
    for(VTimeZone vtimezone : vtimezones) {
        exceptionStamp.getEventCalendar().getComponents().add(0, vtimezone);
    }
    
    noteMod.setClientModifiedDate(new Date());
    noteMod.setLastModifiedBy(noteMod.getModifies().getLastModifiedBy());
    noteMod.setLastModification(ContentItem.Action.EDITED);
    
    setCalendarAttributes(noteMod, event);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:25,代码来源:EntityConverter.java


示例20: checkDatesForEvent

import net.fortuna.ical4j.model.Component; //导入依赖的package包/类
private void checkDatesForEvent(ContentItem item){
    if(!(item instanceof NoteItem)){
        return;
    }
    
    NoteItem noteItem = (NoteItem)item;
    Stamp stamp = noteItem.getStamp("event");
    
    if(!(stamp instanceof EventStamp)){
        return;
    }
    
    EventStamp eventStamp = (EventStamp) stamp;
    
    VEvent masterEvent = eventStamp.getMasterEvent();
    
    checkDatesForComponent(masterEvent);
    
    for(Component component : eventStamp.getExceptions()){
        checkDatesForComponent(component);
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:23,代码来源:StandardContentService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StateMachine类代码示例发布时间:2022-05-21
下一篇:
Java LocalActivityManager类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap