当前位置: 首页>>代码示例>>Java>>正文


Java Cn类代码示例

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


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

示例1: loadPartyAssignment

import net.fortuna.ical4j.model.parameter.Cn; //导入依赖的package包/类
protected static void loadPartyAssignment(Property property, GenericValue partyAssign, Map<String, Object> context) {
    getPartyUrl(property, partyAssign, context);
    if (UtilValidate.isEmpty(property.getValue())) {
        try {
            // RFC 2445 4.8.4.1 and 4.8.4.3 Value must be a URL
            property.setValue("MAILTO:[email protected]");
        } catch (Exception e) {
            Debug.logError(e, "Error while setting Property value: ", module);
        }
    }
    ParameterList parameterList = property.getParameters();
    if (partyAssign != null) {
        replaceParameter(parameterList, toXParameter(partyIdXParamName, partyAssign.getString("partyId")));
        replaceParameter(parameterList, new Cn(makePartyName(partyAssign)));
        replaceParameter(parameterList, toParticipationStatus(partyAssign.getString("assignmentStatusId")));
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:ICalConverter.java

示例2: updateUser

import net.fortuna.ical4j.model.parameter.Cn; //导入依赖的package包/类
public <T extends Property> T updateUser(T target, ICalendarUser user) {

		if (user == null || user.getEmail() == null) {
			return null;
		}

		String email = mailto(user.getEmail(), false);
		String name = user.getName();

		if (target instanceof Organizer) {
			((Organizer) target).setCalAddress(createUri(email));
		}
		if (target instanceof Attendee) {
			((Attendee) target).setCalAddress(createUri(email));
		}
		if (name != null) {
			target.getParameters().add(new Cn(name));
		}

		return target;
	}
 
开发者ID:axelor,项目名称:axelor-business-suite,代码行数:22,代码来源:ICalendarService.java

示例3: addAttendeesToEventWithRole

import net.fortuna.ical4j.model.parameter.Cn; //导入依赖的package包/类
/**
 * Adds attendees to an existing event with a given role
 * Common logic for addAttendeesToEvent and addChairAttendeestoEvent
 *
 * @param vevent  the VEvent to add the attendess too
 * @param attendees list of Users that have been invited to the event
 * @param role      the role with which to add each user
 * @return          the VEvent for the given event or null if there was an error
 */
protected VEvent addAttendeesToEventWithRole(VEvent vevent, Set<User> attendees, Role role) {

	if(!isIcsEnabled()) {
		log.debug("ExternalCalendaringService is disabled. Enable via calendar.ics.generation.enabled=true in sakai.properties");
		return null;
	}
	
	//add attendees to event with 'required participant' role
	if(attendees != null){
		for(User u: attendees) {
			Attendee a = new Attendee(createMailURI(u.getEmail()));
			a.getParameters().add(role);
			a.getParameters().add(new Cn(u.getDisplayName()));
			a.getParameters().add(PartStat.ACCEPTED);
			a.getParameters().add(Rsvp.FALSE);
		
			vevent.getProperties().add(a);
		}
	}
	
	if(log.isDebugEnabled()){
		log.debug("VEvent with attendees:" + vevent);
	}
	
	return vevent;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:36,代码来源:ExternalCalendaringServiceImpl.java

示例4: createTestCalendar

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

示例5: simpleInvitionIcalLink

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

示例6: createEvent

import net.fortuna.ical4j.model.parameter.Cn; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public VEvent createEvent(CalendarEvent event, Set<User> attendees, boolean timeIsLocal) {
	
	if(!isIcsEnabled()) {
		log.debug("ExternalCalendaringService is disabled. Enable via calendar.ics.generation.enabled=true in sakai.properties");
		return null;
	}
	
	VTimeZone tz = getTimeZone(timeIsLocal);

	//start and end date
	DateTime start = new DateTime(getStartDate(event.getRange()).getTime());
	DateTime end = new DateTime(getEndDate(event.getRange()).getTime());
	
	//create event incl title/summary
	VEvent vevent = new VEvent(start, end, event.getDisplayName());
		
	//add timezone
	vevent.getProperties().add(tz.getTimeZoneId());
	
	//add uid to event
	//could come from the vevent_uuid field in the calendar event, otherwise from event ID.
	String uuid = null;
	if(StringUtils.isNotBlank(event.getField("vevent_uuid"))) {
		uuid = event.getField("vevent_uuid");
	} else {
		uuid = event.getId();
	}		
	vevent.getProperties().add(new Uid(uuid));
	
	//add sequence to event
	//will come from the vevent_sequnece field in the calendar event, otherwise skip it
	String sequence = null;
	if(StringUtils.isNotBlank(event.getField("vevent_sequence"))) {
		sequence = event.getField("vevent_sequence");
		vevent.getProperties().add(new Sequence(sequence));
	}
		
	//add description to event
	vevent.getProperties().add(new Description(event.getDescription()));
	
	//add location to event
	vevent.getProperties().add(new Location(event.getLocation()));
	
	//add organiser to event
	if(StringUtils.isNotBlank(event.getCreator())) {

		String creatorEmail = sakaiProxy.getUserEmail(event.getCreator());

		URI mailURI = createMailURI(creatorEmail);
		Cn commonName = new Cn(sakaiProxy.getUserDisplayName(event.getCreator()));

		Organizer organizer = new Organizer(mailURI);
		organizer.getParameters().add(commonName);
		vevent.getProperties().add(organizer);
	}
	
	//add attendees to event with 'required participant' role
	vevent = addAttendeesToEvent(vevent, attendees);
	
	//add URL to event, if present
	String url = null;
	if(StringUtils.isNotBlank(event.getField("vevent_url"))) {
		url = event.getField("vevent_url");
		Url u = new Url();
		try {
			u.setValue(url);
			vevent.getProperties().add(u);
		} catch (URISyntaxException e) {
			//it doesnt matter, ignore it
		}
	}
	
	if(log.isDebugEnabled()){
		log.debug("VEvent:" + vevent);
	}
	
	return vevent;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:82,代码来源:ExternalCalendaringServiceImpl.java

示例7: addCardEvent

import net.fortuna.ical4j.model.parameter.Cn; //导入依赖的package包/类
public void addCardEvent(CardFullWithCounts card, LabelAndValue lav) throws URISyntaxException {

        URI uri = new URI(String.format("%s%s/%s-%s", applicationUrl, card.getProjectShortName(),
            card.getBoardShortName(), card.getSequence()));

        CardDataHistory cardDesc = cardDataService.findLatestDescriptionByCardId(card.getId());

        String name = getEventName(card);

        final UUID id = new UUID(getLong(card.getColumnId(), card.getId()), getLong(lav.getLabelId(),
            lav.getLabelValueId()));

        // Organizer
        UserDescription ud = getUserDescription(card.getCreationUser(), usersCache);

        DateTime dueDate = new DateTime(lav.getLabelValueTimestamp());
        dueDate.setUtc(true);
        final VEvent event = new VEvent(dueDate, name);
        event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE_TIME);

        event.getProperties().add(new Created(new DateTime(card.getCreationDate())));
        event.getProperties().add(new LastModified(new DateTime(card.getLastUpdateTime())));

        event.getProperties().add(new Uid(id.toString()));

        // Reminder on label's date
        if (card.getColumnDefinition() != ColumnDefinition.CLOSED) {
            event.getAlarms().add(createReminder(name));
        }

        // Organizer
        Organizer organizer = new Organizer(URI.create(ud.getEmail()));
        organizer.getParameters().add(new Cn(ud.getName()));
        event.getProperties().add(organizer);

        // Url
        event.getProperties().add(new Url(uri));

        // Description
        if (cardDesc != null) {
            event.getProperties().add(new Description(cardDesc.getContent()));
        }

        events.add(event);
    }
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:46,代码来源:CalendarVEventHandler.java

示例8: convertEmailAddressType

import net.fortuna.ical4j.model.parameter.Cn; //导入依赖的package包/类
/**
 * This method will return a never null a {@link Pair}<{@link ParameterList},{@link URI}> for a given {@link EmailAddressType}
 * This method will return a null URI element if the  {@link EmailAddressType} does not contain a valid EmailAddress property
 * This method will return a never null but possibly empty {@link ParameterList}.  
 * 
 * ParamaterList may contain the following {@link Parameter}s: 
 * {@link Cn}, {@link EmailAddressRoutingType}, {@link EmailAddressMailboxType}
 * 
 * @param recipient
 * @return
 */
protected Pair<ParameterList, URI> convertEmailAddressType(EmailAddressType emailAddressType, Role role){
	URI uri = null;
	ParameterList params = new ParameterList();
	if(null != emailAddressType){
		String emailAddress = emailAddressType.getEmailAddress();
		if(StringUtils.isNotBlank(emailAddress)){
			uri = emailToURI(emailAddress);
		}else{
			log.warn("convertEmailAddressType: could not generate URI.");
		}
		
		if(null != role){
			params.add(role);
		}
		
		String name = emailAddressType.getName();
		if(StringUtils.isNotBlank(name)){
			params.add(new Cn(name));
		}else{
			log.debug("convertEmailAddressType: could not generate Cn");
		}
		String routingType = emailAddressType.getRoutingType();
		if(StringUtils.isNotBlank(routingType)){
			params.add(new EmailAddressRoutingType(routingType));
		}else{
			log.debug("convertEmailAddressType: could not generate EmailAddressRoutingType");
		}
		MailboxTypeType mailboxType = emailAddressType.getMailboxType();
		if(null != mailboxType){
			params.add(new EmailAddressMailboxType(mailboxType));
			CuType cuType = convertMailboxTypeTypeToCuType(mailboxType,role);
			params.add(cuType);
		}else{
			log.debug("convertEmailAddressType: could not generate EmailAddressMailboxType");
		}
	}else{
		log.debug("convertEmailAddressType: EmailAddressType = null");
	}
	Pair<ParameterList,URI> pair = Pair.of(params, uri);
	return pair;
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:53,代码来源:ExchangeEventConverterImpl.java

示例9: createTestCalendar

import net.fortuna.ical4j.model.parameter.Cn; //导入依赖的package包/类
private 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:wildfly-extras,项目名称:wildfly-camel,代码行数:62,代码来源:ICalFormatTest.java


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