本文整理汇总了Java中net.fortuna.ical4j.model.parameter.Role类的典型用法代码示例。如果您正苦于以下问题:Java Role类的具体用法?Java Role怎么用?Java Role使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Role类属于net.fortuna.ical4j.model.parameter包,在下文中一共展示了Role类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertMailboxTypeTypeToCuType
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的package包/类
/**
* Return a never null {@link CuType} for a given {@link MailboxTypeType}
*
* Defaults to CuType.INDIVIDUAL
*
* @see <a href="http://www.kanzaki.com/docs/ical/cutype.html">Calendar User Type</a>
* @see <a href="http://msdn.microsoft.com/en-us/library/office/aa563493(v=exchg.140).aspx">MailboxType</a>
*
* @param mailboxType
* @return
*/
public static CuType convertMailboxTypeTypeToCuType(MailboxTypeType mailboxType, Role role){
//If not specified on a property that allows this parameter, the default is INDIVIDUAL.
CuType cuType = CuType.INDIVIDUAL;
if(null != mailboxType){
if(MailboxTypeType.PRIVATE_DL.equals(mailboxType) || MailboxTypeType.PUBLIC_DL.equals(mailboxType)){
cuType = CuType.GROUP;
}
//TODO this is bad hack
if(Role.NON_PARTICIPANT.equals(role)){
cuType = CuType.RESOURCE;
}
}
return cuType;
}
示例2: addAttendeesToEventWithRole
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的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;
}
示例3: createSimpleContentItem
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的package包/类
/**
* Creates a simple item which will be checked with simpleCheckCallExpectedHandler.
*
* @param user
* @return
* @throws URISyntaxException
*/
private ContentItem createSimpleContentItem(User user) throws URISyntaxException {
//call service
ContentItem contentItem = testHelper.makeDummyContent(user);
HibEventStamp eventStamp = new HibEventStamp();
VEvent vEvent = new VEvent();
vEvent.getProperties().add(Method.REQUEST);
vEvent.getProperties().add(Version.VERSION_2_0);
Attendee dev1 = new Attendee(URI.create("MAILTO:" + ATTENDEE_1));
dev1.getParameters().add(Role.REQ_PARTICIPANT);
dev1.getParameters().add(PartStat.NEEDS_ACTION);
dev1.getParameters().add(Rsvp.TRUE);
vEvent.getProperties().add(dev1);
Organizer organizer = new Organizer("MAILTO:" + ORGANIZER);
vEvent.getProperties().add(organizer);
vEvent.getProperties().add(Status.VEVENT_CONFIRMED);
vEvent.getProperties().add(Transp.OPAQUE);
Calendar calendar = new Calendar();
calendar.getComponents().add(vEvent);
eventStamp.setEventCalendar(calendar);
contentItem.addStamp(eventStamp);
return contentItem;
}
示例4: convertAttendees
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的package包/类
/**
* This method returns a never null but possibly empty {@link HashSet} of {@link Attendee}s.
* This method will attempt to generate a {@link Attendee} for each {@link AttendeeType} contained within @link {@link NonEmptyArrayOfAttendeesType}.
* An a {@link Attendee} will not be generated for any {@link AttendeeType} with a missing or invalid {@link EmailAddressType}
*
* Attendee Responses are only present if you obtained CalendarItem from Exchange as organizer. @see <a href="http://office.microsoft.com/en-us/outlook-help/organize-meetings-with-outlook-RZ001166003.aspx?section=20">Attendees do not see responses</a>
*
* {@link com.microsoft.exchange.impl.ExchangeEventConverterImpl.convertEmailAddressType(EmailAddressType)} for details on how recipient EmailAddressType properties are mapped to {@link Parameter}s.
*
* @param attendees
* @param myResponseType - a {@link PartStat} parameter will be added to every {@link Attendee} if and only if myResponseType.eqals( {@link ResponseTypeType}.ORGANIZER and the corresponding {@link AttendeeType} contains a valid {@link ResponseTypeType} )
* @param requiredAttendees - Indicates which {@link Role} parameter to add to attendees. True indicates that the {@link NonEmptyArrayOfAttendeesType} represent Role.REQ_PARTICIPANT, false indicates the {@link NonEmptyArrayOfAttendeesType} are optional attendees
* @return
*/
protected Set<Attendee> convertAttendees(NonEmptyArrayOfAttendeesType attendees,ResponseTypeType myResponseType, Role role){
Set<Attendee> attendeeSet = new HashSet<Attendee>();
if(null != attendees && !CollectionUtils.isEmpty(attendees.getAttendees())){
for(AttendeeType attendeeType : attendees.getAttendees()){
if(null != attendeeType){
EmailAddressType mailbox = attendeeType.getMailbox();
Pair<ParameterList, URI> attendeePair = convertEmailAddressType(mailbox, role);
URI attendeeURI = attendeePair.getRight();
ParameterList attendeeParams = attendeePair.getLeft();
if(null != attendeeURI){
Attendee attendee = new Attendee(attendeeParams, attendeeURI);
if(null != myResponseType && myResponseType.equals(ResponseTypeType.ORGANIZER)){
//responseType should be present
ResponseTypeType responseType = attendeeType.getResponseType();
if(null != responseType){
//go ahead and add a partstat
attendee.getParameters().add(convertResponseTypeTypeToPartStat(responseType));
}
}
if(attendeeSet.add(attendee)){
log.debug("added Attendee="+attendee);
}
}
}
}
}else{
log.debug("no attendees");
}
return attendeeSet;
}
示例5: createTestCalendar
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的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;
}
示例6: simpleInvitionIcalLink
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的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);
}
}
示例7: addAttendeesToEvent
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public VEvent addAttendeesToEvent(VEvent vevent, Set<User> attendees) {
return addAttendeesToEventWithRole(vevent, attendees, Role.REQ_PARTICIPANT);
}
示例8: addChairAttendeesToEvent
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public VEvent addChairAttendeesToEvent(VEvent vevent, Set<User> attendees) {
return addAttendeesToEventWithRole(vevent, attendees, Role.CHAIR);
}
示例9: convertEmailAddressType
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的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;
}
示例10: convertRequiredAttendees
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的package包/类
public Set<Attendee> convertRequiredAttendees(NonEmptyArrayOfAttendeesType attendees,ResponseTypeType myResponseType){
return convertAttendees(attendees, myResponseType, Role.REQ_PARTICIPANT);
}
示例11: convertOptionalAttendees
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的package包/类
public Set<Attendee> convertOptionalAttendees(NonEmptyArrayOfAttendeesType attendees,ResponseTypeType myResponseType){
return convertAttendees(attendees, myResponseType, Role.OPT_PARTICIPANT);
}
示例12: convertResourceAttendees
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的package包/类
public Set<Attendee> convertResourceAttendees(NonEmptyArrayOfAttendeesType attendees,ResponseTypeType myResponseType){
return convertAttendees(attendees, myResponseType, Role.NON_PARTICIPANT);
}
示例13: createTestCalendar
import net.fortuna.ical4j.model.parameter.Role; //导入依赖的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;
}