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

Java ProdId类代码示例

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

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



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

示例1: icalResponse

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
private GetEventsResponse icalResponse(Page<EventEntity> eventPage) {
    Calendar calendar = new Calendar();
    calendar.getProperties().add(new ProdId("-//PutPut//iCal4j 1.0//EN"));
    calendar.getProperties().add(Version.VERSION_2_0);
    calendar.getProperties().add(CalScale.GREGORIAN);
    
    eventPage
            .getContent()
            .stream()
            .forEach(event -> {
                TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
                net.fortuna.ical4j.model.TimeZone timezone = registry.getTimeZone(event.getTimezone());
                
                VEvent vEvent = createVEvent(event, timezone);
                
                vEvent.getProperties().add(new Uid(event.getId()));
                vEvent.getProperties().add(new Description(event.getDescription()));
                vEvent.getProperties().add(new Location(event.getLocation()));
                vEvent.getProperties().add(timezone.getVTimeZone().getTimeZoneId());
                
                calendar.getComponents().add(vEvent);
            });
    
    return GetEventsResponse.withCalendarOK(calendar.toString());
}
 
开发者ID:adrobisch,项目名称:putput,代码行数:26,代码来源:EventsResource.java


示例2: createCalendar

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


示例3: parseAppointmenttoCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Methods to parse Appointment to iCalendar according RFC 2445
 *
 * @param appointment to be converted to iCalendar
 * @return iCalendar representation of the Appointment
 */
public Calendar parseAppointmenttoCalendar(Appointment appointment) {
	String tzid = parseTimeZone(null, appointment.getOwner()).getID();

	TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();

	net.fortuna.ical4j.model.TimeZone timeZone = registry.getTimeZone(tzid);
	if (timeZone == null) {
		throw new NoSuchElementException("Unable to get time zone by id provided: " + tzid);
	}

	Calendar icsCalendar = new Calendar();
	icsCalendar.getProperties().add(new ProdId("-//Events Calendar//Apache Openmeetings//EN"));
	icsCalendar.getProperties().add(Version.VERSION_2_0);
	icsCalendar.getProperties().add(CalScale.GREGORIAN);
	icsCalendar.getComponents().add(timeZone.getVTimeZone());

	DateTime start = new DateTime(appointment.getStart()), end = new DateTime(appointment.getEnd());

	VEvent meeting = new VEvent(start, end, appointment.getTitle());
	meeting = addVEventpropsfromAppointment(appointment, meeting);
	icsCalendar.getComponents().add(meeting);

	return icsCalendar;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:31,代码来源:IcalUtils.java


示例4: parseAppointmentstoCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Parses a List of Appointments into a VCALENDAR component.
 *
 * @param appointments List of Appointments for the Calendar
 * @param ownerId      Owner of the Appointments
 * @return VCALENDAR representation of the Appointments
 */
public Calendar parseAppointmentstoCalendar(List<Appointment> appointments, Long ownerId) {
	String tzid = parseTimeZone(null, userDao.get(ownerId)).getID();

	TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();

	net.fortuna.ical4j.model.TimeZone timeZone = registry.getTimeZone(tzid);
	if (timeZone == null) {
		throw new NoSuchElementException("Unable to get time zone by id provided: " + tzid);
	}

	Calendar icsCalendar = new Calendar();
	icsCalendar.getProperties().add(new ProdId(PROD_ID));
	icsCalendar.getProperties().add(Version.VERSION_2_0);
	icsCalendar.getProperties().add(CalScale.GREGORIAN);
	icsCalendar.getComponents().add(timeZone.getVTimeZone());

	for (Appointment appointment : appointments) {
		DateTime start = new DateTime(appointment.getStart()), end = new DateTime(appointment.getEnd());

		VEvent meeting = new VEvent(start, end, appointment.getTitle());
		meeting = addVEventpropsfromAppointment(appointment, meeting);
		icsCalendar.getComponents().add(meeting);
	}
	return icsCalendar;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:33,代码来源:IcalUtils.java


示例5: generateCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Generates a Calendar Object
 * @param user 
 * @param project
 * @return Calendar of the user
 * 		   null if the calendar has not got events
 * @throws TooManyItemsToLoadException 
 */
private Calendar generateCalendar(TPersonBean user, String project) throws IOException, TooManyItemsToLoadException {
	Calendar calendar = new Calendar();
	
	calendar.getProperties().add(new ProdId("Calendar of Projects: "+ project));
	calendar.getProperties().add(Version.VERSION_2_0);
	calendar.getProperties().add(CalScale.GREGORIAN);
	calendar.getProperties().add(Method.PUBLISH);
	
	List<TWorkItemBean> workItemList = obtainIssues(user, project);
	
	if (workItemList!=null&&workItemList.size()!=0){
		addEventsFromWorkItemList(workItemList, calendar, user.getLocale());
		return calendar;
	}	
	else {
		return calendar;
	}
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:27,代码来源:ICalendarSynchronizeAction.java


示例6: createCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
public static Calendar createCalendar(List<EventBean> events) {

        final String prodIdCompany = Unit.getInstitutionName().getContent();
        Calendar calendar = new Calendar();
        calendar.getProperties().add(new ProdId("-//" + prodIdCompany + "//" + PROD_ID_APPLICATION + "//PT"));
        calendar.getProperties().add(Version.VERSION_2_0);
        calendar.getProperties().add(CalScale.GREGORIAN);

        VTimeZone tz = TIMEZONE.getVTimeZone();
        calendar.getComponents().add(tz);

        for (EventBean eventBean : events) {
            calendar.getComponents().add(convertEventBean(eventBean));
        }
        return calendar;

    }
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:18,代码来源:CalendarFactory.java


示例7: IcalHandler

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param method
 *            (@see IcalHandler) constants
 */
public IcalHandler(Method method) {
	log.debug("Icalhandler method type : " + method);

	icsCalendar = new Calendar();
	icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
	icsCalendar.getProperties().add(Version.VERSION_2_0);
	icsCalendar.getProperties().add(CalScale.GREGORIAN);
	icsCalendar.getProperties().add(method);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:16,代码来源:IcalHandler.java


示例8: setupCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Helper method to setup the standard parts of the calendar
 * @return
 */
private Calendar setupCalendar(String method) {
	
	String serverName = sakaiProxy.getServerName();
	
	//setup calendar
	Calendar calendar = new Calendar();
	calendar.getProperties().add(new ProdId("-//"+serverName+"//Sakai External Calendaring Service//EN"));
	calendar.getProperties().add(Version.VERSION_2_0);
	calendar.getProperties().add(CalScale.GREGORIAN);
	if (method != null) {
		calendar.getProperties().add(new Method(method));
	}
	return calendar;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:ExternalCalendaringServiceImpl.java


示例9: adaptTimezoneCalendarComponent

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
public static void adaptTimezoneCalendarComponent(Calendar calendar) {
    //ios 7 doesn't send product id on create calendar method
    if(calendar.getProductId() == null){
        calendar.getProperties().add(new ProdId("UNKNOWN_PRODID"));
    }
    
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:8,代码来源:CalendarClientsAdapter.java


示例10: getFreeBusyCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Obfuscates the specified calendar by removing unnecessary properties and replacing text fields with specified
 * text.
 * 
 * @param original
 *            calendar to be obfuscated
 * @param productId
 *            productId to be set for the copy calendar.
 * @param freeBusyText
 * @return obfuscated calendar.
 */
public static Calendar getFreeBusyCalendar(Calendar original, String productId, String freeBusyText) {
    // Make a copy of the original calendar
    Calendar copy = new Calendar();
    copy.getProperties().add(new ProdId(productId));
    copy.getProperties().add(Version.VERSION_2_0);
    copy.getProperties().add(CalScale.GREGORIAN);
    copy.getProperties().add(new XProperty(FREE_BUSY_X_PROPERTY, Boolean.TRUE.toString()));

    ComponentList<CalendarComponent> events = original.getComponents(Component.VEVENT);
    for (Component event : events) {
        copy.getComponents().add(getFreeBusyEvent((VEvent) event, freeBusyText));
    }
    return copy;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:26,代码来源:FreeBusyUtil.java


示例11: getCalendarFromCollection

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * @param collectionItem
 * @return
 */
private Calendar getCalendarFromCollection(DavRequest req, CollectionItem collectionItem) {
    Calendar result = new Calendar();

    if (productId == null) {
        synchronized (this) {
            if (productId == null) {
                Environment environment = WebApplicationContextUtils
                        .findWebApplicationContext(req.getServletContext()).getEnvironment();
                productId = environment.getProperty(PRODUCT_ID_KEY);
            }
        }
    }

    result.getProperties().add(new ProdId(productId));
    result.getProperties().add(Version.VERSION_2_0);
    result.getProperties().add(CalScale.GREGORIAN);

    for (Item item : collectionItem.getChildren()) {
        if (!NoteItem.class.isInstance(item)) {
            continue;
        }
        for (Stamp s : item.getStamps()) {
            if (BaseEventStamp.class.isInstance(s)) {
                BaseEventStamp baseEventStamp = BaseEventStamp.class.cast(s);
                result.getComponents().add(baseEventStamp.getEvent());
            }
        }
    }
    return result;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:35,代码来源:CalendarCollectionProvider.java


示例12: testICalendarAttribute

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Test ICalendar attribute.
 * @throws Exception - if something is wrong this exception is thrown.
 */
@Test
public void testICalendarAttribute() throws Exception {
    User user = getUser(userDao, "testuser");
    CollectionItem root = (CollectionItem) contentDao.getRootItem(user);

    ContentItem item = generateTestContent();
   
    ICalendarAttribute icalAttr = new HibICalendarAttribute(); 
    icalAttr.setQName(new HibQName("icalattribute"));
    icalAttr.setValue(helper.getInputStream("vjournal.ics"));
    item.addAttribute(icalAttr);
    
    ContentItem newItem = contentDao.createContent(root, item);

    clearSession();

    ContentItem queryItem = (ContentItem) contentDao.findItemByUid(newItem.getUid());

    Attribute attr = queryItem.getAttribute(new HibQName("icalattribute"));
    Assert.assertNotNull(attr);
    Assert.assertTrue(attr instanceof ICalendarAttribute);
    
    net.fortuna.ical4j.model.Calendar calendar = (net.fortuna.ical4j.model.Calendar) attr.getValue();
    Assert.assertNotNull(calendar);
    
    net.fortuna.ical4j.model.Calendar expected = CalendarUtils.parseCalendar(helper.getInputStream("vjournal.ics"));
    
    Assert.assertEquals(expected.toString(),calendar.toString());
    
    calendar.getProperties().add(new ProdId("blah"));
    contentDao.updateContent(queryItem);
    
    clearSession();
    
    queryItem = (ContentItem) contentDao.findItemByUid(newItem.getUid());
    ICalendarAttribute ica = (ICalendarAttribute) queryItem.getAttribute(new HibQName("icalattribute"));
    Assert.assertEquals(calendar, ica.getValue());
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:43,代码来源:HibernateContentDaoTest.java


示例13: makeDummyCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Makes dummy calendar.
 * @return The dummy calendar.
 */
public Calendar makeDummyCalendar() {
    Calendar cal =new Calendar();

    cal.getProperties().add(new ProdId(CosmoConstants.PRODUCT_ID));
    cal.getProperties().add(Version.VERSION_2_0);

    return cal;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:13,代码来源:TestHelper.java


示例14: buildCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
private Calendar buildCalendar(final OlatCalendar olatCalendar) {
    final Calendar calendar = new Calendar();
    // add standard propeties
    calendar.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
    calendar.getProperties().add(Version.VERSION_2_0);
    calendar.getProperties().add(CalScale.GREGORIAN);
    for (final Iterator<CalendarEntry> iter = olatCalendar.getAllCalendarEntries().iterator(); iter.hasNext();) {
        final CalendarEntry kEvent = iter.next();
        final VEvent vEvent = getVEvent(kEvent);
        calendar.getComponents().add(vEvent);
    }
    return calendar;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:14,代码来源:CalendarDaoICalFileImpl.java


示例15: getCalDavCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
public Calendar getCalDavCalendar(String userToken) throws URISyntaxException, ParseException {
    UserWithPermission user;

    try {
        user = findUserFromCalendarToken(userToken);
    } catch (EmptyResultDataAccessException ex) {
        throw new SecurityException("Invalid token");
    }

    if (userRepository.isCalendarFeedDisabled(user)) {
        throw new SecurityException("Calendar feed disabled");
    }

    final Calendar calendar = new Calendar();
    calendar.getProperties().add(new ProdId("-//Lavagna//iCal4j 1.0//EN"));
    calendar.getProperties().add(Version.VERSION_2_0);
    calendar.getProperties().add(CalScale.GREGORIAN);
    calendar.getProperties().add(Method.PUBLISH);

    final List<VEvent> events = new ArrayList<>();
    final String applicationUrl = StringUtils
        .appendIfMissing(configurationRepository.getValue(Key.BASE_APPLICATION_URL), "/");
    final CalendarEventHandler handler = new CalendarVEventHandler(applicationUrl, cardDataService, userRepository,
        events);

    // Milestones
    addMilestoneEvents(handler, user);

    // Cards
    addCardEvents(handler, user);

    calendar.getComponents().addAll(events);

    return calendar;
}
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:36,代码来源:CalendarService.java


示例16: newCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
public static Calendar newCalendar() {
	final Calendar cal = new Calendar();
	cal.getProperties().add(new ProdId(PRODUCT_ID));
	cal.getProperties().add(Version.VERSION_2_0);
	cal.getProperties().add(CalScale.GREGORIAN);
	return cal;
}
 
开发者ID:axelor,项目名称:axelor-business-suite,代码行数:8,代码来源:ICalendarService.java


示例17: convertedCalendarHasProdId

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
@Test
public void convertedCalendarHasProdId(){
	Calendar calendar = eventConverter.convertToCalendar(null, null);
	ProdId productId = calendar.getProductId();
	assertNotNull(productId);
	assertEquals(ExchangeEventConverter.PROD_ID, productId);
	log.info("productId="+productId);
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:9,代码来源:ExchangeEventConverterImplTest.java


示例18: createTestCalendar

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
 * Creates test calendar instance.
 * 
 * @return ICal calendar object.
 */
protected Calendar createTestCalendar() throws ParseException {
 // Create a TimeZone
    TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
    TimeZone timezone = registry.getTimeZone("America/New_York");
    VTimeZone tz = timezone.getVTimeZone();

     // Start Date is on: April 1, 2013, 9:00 am
    java.util.Calendar startDate = new GregorianCalendar();
    startDate.setTimeZone(timezone);
    startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
    startDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
    startDate.set(java.util.Calendar.YEAR, 2013);
    startDate.set(java.util.Calendar.HOUR_OF_DAY, 17);
    startDate.set(java.util.Calendar.MINUTE, 0);
    startDate.set(java.util.Calendar.SECOND, 0);

     // End Date is on: April 1, 2013, 13:00
    java.util.Calendar endDate = new GregorianCalendar();
    endDate.setTimeZone(timezone);
    endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
    endDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
    endDate.set(java.util.Calendar.YEAR, 2013);
    endDate.set(java.util.Calendar.HOUR_OF_DAY, 21);
    endDate.set(java.util.Calendar.MINUTE, 0);  
    endDate.set(java.util.Calendar.SECOND, 0);

    // Create the event
    PropertyList propertyList = new PropertyList();
    propertyList.add(new DtStamp("20130324T180000Z"));
    propertyList.add(new DtStart(new DateTime(startDate.getTime())));
    propertyList.add(new DtEnd(new DateTime(endDate.getTime())));
    propertyList.add(new Summary("Progress Meeting"));
    VEvent meeting = new VEvent(propertyList);

    // add timezone info..
    meeting.getProperties().add(tz.getTimeZoneId());

    // generate unique identifier..
    meeting.getProperties().add(new Uid("00000000"));

    // add attendees..
    Attendee dev1 = new Attendee(URI.create("mailto:[email protected]"));
    dev1.getParameters().add(Role.REQ_PARTICIPANT);
    dev1.getParameters().add(new Cn("Developer 1"));
    meeting.getProperties().add(dev1);

    Attendee dev2 = new Attendee(URI.create("mailto:[email protected]"));
    dev2.getParameters().add(Role.OPT_PARTICIPANT);
    dev2.getParameters().add(new Cn("Developer 2"));
    meeting.getProperties().add(dev2);

    // Create a calendar
    net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar();
    icsCalendar.getProperties().add(Version.VERSION_2_0);
    icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
    icsCalendar.getProperties().add(CalScale.GREGORIAN);

    // Add the event and print
    icsCalendar.getComponents().add(meeting);
    return icsCalendar;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:67,代码来源:ICalDataFormatTest.java


示例19: main

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	calendar = new Calendar();
	calendar.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
	calendar.getProperties().add(Version.VERSION_2_0);
	calendar.getProperties().add(CalScale.GREGORIAN);
	java.util.Calendar javaCalendar = java.util.Calendar.getInstance();
	javaCalendar.set(java.util.Calendar.MONTH, java.util.Calendar.DECEMBER);
	javaCalendar.set(java.util.Calendar.DAY_OF_MONTH, 25);

	// initialise as an all-day event..
	VEvent christmas = new VEvent(new Date(javaCalendar.getTime()), "Christmas Day");

	// Generate a UID for the event..
	UidGenerator ug = new UidGenerator("1");
	christmas.getProperties().add(ug.generateUid());

	calendar.getComponents().add(christmas);


	JSONArray jsonArray = readJsonFromUrl(VERSION_TRACK_URL);
	String name;
	String url;
	String venue;
	String mapLocation;
	String version;
	String forceTrack;

	for (int i = 0; i < jsonArray.length(); i++) {
		try {
			name = jsonArray.getJSONObject(i).getJSONArray("c").getJSONObject(0)
					.getString("v");
			url = jsonArray.getJSONObject(i).getJSONArray("c").getJSONObject(1)
					.getString("f");
			venue = jsonArray.getJSONObject(i).getJSONArray("c").getJSONObject(2)
					.getString("v");
			version = jsonArray.getJSONObject(i).getJSONArray("c").getJSONObject(8)
					.getString("v");
			mapLocation = jsonArray.getJSONObject(i).getJSONArray("c").getJSONObject(5)
					.getString("v");

			fetchData(PART_URL+url, venue, name, (i+23)*100);





		} catch (JSONException e) {
			e.printStackTrace();
		}

	}

	FileOutputStream fout = new FileOutputStream("mycalendar.ics");

	CalendarOutputter outputter = new CalendarOutputter();
	outputter.output(calendar, fout);

}
 
开发者ID:OpnTec,项目名称:ots15-companion,代码行数:59,代码来源:Main.java


示例20: simpleInvitionIcalLink

import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
public void simpleInvitionIcalLink() {
	// Create a TimeZone
	TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
	TimeZone timezone = registry.getTimeZone("America/Mexico_City");
	VTimeZone tz = timezone.getVTimeZone();

	// Start Date is on: April 1, 2008, 9:00 am
	java.util.Calendar startDate = new GregorianCalendar();
	startDate.setTimeZone(timezone);
	startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
	startDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
	startDate.set(java.util.Calendar.YEAR, 2008);
	startDate.set(java.util.Calendar.HOUR_OF_DAY, 9);
	startDate.set(java.util.Calendar.MINUTE, 0);
	startDate.set(java.util.Calendar.SECOND, 0);

	// End Date is on: April 1, 2008, 13:00
	java.util.Calendar endDate = new GregorianCalendar();
	endDate.setTimeZone(timezone);
	endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
	endDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
	endDate.set(java.util.Calendar.YEAR, 2008);
	endDate.set(java.util.Calendar.HOUR_OF_DAY, 13);
	endDate.set(java.util.Calendar.MINUTE, 0);
	endDate.set(java.util.Calendar.SECOND, 0);

	// Create the event
	String eventName = "Progress Meeting";
	DateTime start = new DateTime(startDate.getTime());
	DateTime end = new DateTime(endDate.getTime());
	VEvent meeting = new VEvent(start, end, eventName);

	// add timezone info..
	meeting.getProperties().add(tz.getTimeZoneId());

	// generate unique identifier..
	Uid uid = new Uid(UUID.randomUUID().toString());
	meeting.getProperties().add(uid);

	// add attendees..
	Attendee dev1 = new Attendee(URI.create("mailto:[email protected]"));
	dev1.getParameters().add(Role.REQ_PARTICIPANT);
	dev1.getParameters().add(new Cn("Developer 1"));
	meeting.getProperties().add(dev1);

	Attendee dev2 = new Attendee(URI.create("mailto:[email protected]"));
	dev2.getParameters().add(Role.OPT_PARTICIPANT);
	dev2.getParameters().add(new Cn("Developer 2"));
	meeting.getProperties().add(dev2);

	// Create a calendar
	net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar();
	icsCalendar.getProperties().add(
			new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
	icsCalendar.getProperties().add(CalScale.GREGORIAN);
	icsCalendar.getProperties().add(Version.VERSION_2_0);

	// Add the event and print
	icsCalendar.getComponents().add(meeting);

	Organizer orger = new Organizer(URI.create("[email protected]"));
	orger.getParameters().add(new Cn("Sebastian Wagner"));
	meeting.getProperties().add(orger);

	icsCalendar.getProperties().add(Method.REQUEST);

	log.debug(icsCalendar.toString());

	ByteArrayOutputStream bout = new ByteArrayOutputStream();
	CalendarOutputter outputter = new CalendarOutputter();
	try {
		outputter.output(icsCalendar, bout);
		iCalMimeBody = bout.toByteArray();

		sendIcalMessage();
	} catch (Exception e) {
		log.error("Error", e);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:80,代码来源:TestSendIcalMessage.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java PipelineOptionsFactory类代码示例发布时间:2022-05-21
下一篇:
Java ButtonBarBuilder类代码示例发布时间: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