本文整理汇总了Java中net.fortuna.ical4j.model.property.Attendee类的典型用法代码示例。如果您正苦于以下问题:Java Attendee类的具体用法?Java Attendee怎么用?Java Attendee使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Attendee类属于net.fortuna.ical4j.model.property包,在下文中一共展示了Attendee类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findOrCreateUser
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
protected ICalendarUser findOrCreateUser(Property source) {
URI addr = null;
if (source instanceof Organizer) {
addr = ((Organizer) source).getCalAddress();
}
if (source instanceof Attendee) {
addr = ((Attendee) source).getCalAddress();
}
if (addr == null) {
return null;
}
String email = mailto(addr.toString(), true);
ICalendarUserRepository repo = Beans.get(ICalendarUserRepository.class);
ICalendarUser user = repo.findByEmail(email);
if (user == null) {
user = new ICalendarUser();
user.setEmail(email);
}
if (source.getParameter(Parameter.CN) != null) {
user.setName(source.getParameter(Parameter.CN).getValue());
}
return user;
}
示例2: updateUser
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的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;
}
示例3: loadRelatedParties
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
protected static void loadRelatedParties(List<GenericValue> relatedParties, PropertyList componentProps, Map<String, Object> context) {
PropertyList attendees = componentProps.getProperties("ATTENDEE");
for (GenericValue partyValue : relatedParties) {
if ("CAL_ORGANIZER~CAL_OWNER".contains(partyValue.getString("roleTypeId"))) {
// RFC 2445 4.6.1, 4.6.2, and 4.6.3 ORGANIZER can appear only once
replaceProperty(componentProps, createOrganizer(partyValue, context));
} else {
String partyId = partyValue.getString("partyId");
boolean newAttendee = true;
Attendee attendee = null;
Iterator<Attendee> i = UtilGenerics.cast(attendees.iterator());
while (i.hasNext()) {
attendee = i.next();
Parameter xParameter = attendee.getParameter(partyIdXParamName);
if (xParameter != null && partyId.equals(xParameter.getValue())) {
loadPartyAssignment(attendee, partyValue, context);
newAttendee = false;
break;
}
}
if (newAttendee) {
attendee = createAttendee(partyValue, context);
componentProps.add(attendee);
}
}
}
}
示例4: addAttendeesToEventWithRole
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的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;
}
示例5: getAttendeesFrom
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
private List<String> getAttendeesFrom(VEvent event) {
List<String> addresses = new ArrayList<String>();
for(int i = 0; i < event.getProperties().size(); i++){
if(event.getProperties().get(i) instanceof Attendee){
Attendee attendee = (Attendee)event.getProperties().get(i);
if(attendee.getCalAddress() != null){
String mailto[] = attendee.getCalAddress().toString().split(":");
addresses.add(mailto[mailto.length - 1]);
}
}
}
return addresses;
}
示例6: createSimpleContentItem
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的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;
}
示例7: convertAttendees
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的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;
}
示例8: createTestEvent
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
private void createTestEvent(LocalCalendar calendar) {
try {
TimeZone tzVienna = DateUtils.tzRegistry.getTimeZone("Europe/Vienna");
Event event = new Event();
event.uid = "[email protected]";
event.summary = "Sample event";
event.description = "Sample event with date/time";
event.location = "Sample location";
event.dtStart = new DtStart("20150501T120000", tzVienna);
event.dtEnd = new DtEnd("20150501T130000", tzVienna);
event.organizer = new Organizer(new URI("mailto:[email protected]"));
event.rRule = new RRule("FREQ=DAILY;COUNT=10");
event.forPublic = false;
event.status = Status.VEVENT_CONFIRMED;
// set an alarm one day, two hours, three minutes and four seconds before begin of event
event.alarms.add(new VAlarm(new Dur(-1, -2, -3, -4)));
// add two attendees
event.attendees.add(new Attendee(new URI("mailto:[email protected]")));
event.attendees.add(new Attendee(new URI("mailto:[email protected]")));
// add exception with alarm and attendee
Event exception = new Event();
exception.recurrenceId = new RecurrenceId("20150502T120000", tzVienna);
exception.summary = "Exception for sample event";
exception.dtStart = new DtStart("20150502T140000", tzVienna);
exception.dtEnd = new DtEnd("20150502T150000", tzVienna);
exception.alarms.add(new VAlarm(new Dur(-2, -3, -4, -5)));
exception.attendees.add(new Attendee(new URI("mailto:[email protected]")));
event.exceptions.add(exception);
// add EXDATE
event.exDates.add(new ExDate(new DateList("20150502T120000", Value.DATE_TIME, tzVienna)));
// add to calendar
Uri uri = new LocalEvent(calendar, event, null, null).add();
showMessage("Event created: " + uri);
showEvents(calendar);
} catch (Exception e) {
e.printStackTrace();
showMessage(e.toString());
}
}
示例9: createAttendee
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
protected static Attendee createAttendee(GenericValue partyValue, Map<String, Object> context) {
Attendee attendee = new Attendee();
loadPartyAssignment(attendee, partyValue, context);
return attendee;
}
示例10: createTestCalendar
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的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;
}
示例11: simpleInvitionIcalLink
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的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);
}
}
示例12: main
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
public static void main (final String... args)
throws Exception
{
final String ical = "BEGIN:VCALENDAR\n" +
"PRODID:-//ACME/DesktopCalendar//EN\n" +
"METHOD:REQUEST\n" +
"X-LIC-NOTE: #I1. Reschedules C1\n" +
"VERSION:2.0\n" +
"BEGIN:VEVENT\n" +
"ORGANIZER:Mailto:[email protected]\n" +
"ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:[email protected]\n" +
"ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:[email protected]\n" +
"ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:[email protected]\n" +
"ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:[email protected]\n" +
"ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:[email protected]\n" +
"ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:[email protected]\n" +
"DTSTAMP:19970611T190000Z\n" +
"DTSTART:19970701T200000Z\n" +
"DTEND:19970701T2000000Z\n" +
"SUMMARY:Conference\n" +
"UID:[email protected]\n" +
"SEQUENCE:2\n" +
"STATUS:CONFIRMED\n" +
"END:VEVENT\n" +
"END:VCALENDAR";
final SimpleDateFormat dateFormat = new SimpleDateFormat();
final CalendarBuilder calendarBuilder = new CalendarBuilder();
final Calendar calendar = calendarBuilder.build(new StringReader(ical));
final Method method = calendar.getMethod();
System.out.println(method.getValue()); // REQUEST, e.g.
System.out.println(method == Method.REQUEST);
for (final Component component : (List<Component>)calendar.getComponents())
{
System.out.println(component.getName()); // VEVENT, e.g.
if (component instanceof VEvent)
{
final VEvent vevent = (VEvent) component;
System.out.println(vevent.getSummary());
System.out.println(vevent.getDescription());
System.out.println(dateFormat.format(vevent.getStartDate().getDate()));
}
for (final Property property : (List<Property>) component.getProperties(Property.ATTENDEE))
{
final Attendee attendee = (Attendee) property;
System.out.println(attendee.getCalAddress().getSchemeSpecificPart());
System.out.println(attendee.getParameter(Parameter.CN));
System.out.println(attendee.getName());
System.out.println(attendee.getValue());
}
}
System.out.println("END");
System.exit(0);
}
示例13: findOrCreateUser
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
protected ICalendarUser findOrCreateUser(Property source, Event event) {
URI addr = null;
if (source instanceof Organizer) {
addr = ((Organizer) source).getCalAddress();
}
if (source instanceof Attendee) {
addr = ((Attendee) source).getCalAddress();
}
if (addr == null) {
return null;
}
String email = mailto(addr.toString(), true);
ICalendarUserRepository repo = Beans.get(ICalendarUserRepository.class);
ICalendarUser user = null;
if (source instanceof Organizer) {
user = repo.all().filter("self.email = ?1", email).fetchOne();
}
else{
user = repo.all().filter("self.email = ?1 AND self.event.id = ?2", email, event.getId()).fetchOne();
}
if (user == null) {
user = new ICalendarUser();
user.setEmail(email);
user.setName(email);
EmailAddress emailAddress = Beans.get(EmailAddressRepository.class).findByAddress(email);
if(emailAddress != null && emailAddress.getPartner() != null && emailAddress.getPartner().getUser() != null){
user.setUser(emailAddress.getPartner().getUser());
}
}
if (source.getParameter(Parameter.CN) != null) {
user.setName(source.getParameter(Parameter.CN).getValue());
}
if(source.getParameter(Parameter.PARTSTAT) != null){
String role = source.getParameter(Parameter.PARTSTAT).getValue();
if(role.equals("TENTATIVE")){
user.setStatusSelect(ICalendarUserRepository.STATUS_MAYBE);
}
else if(role.equals("ACCEPTED")){
user.setStatusSelect(ICalendarUserRepository.STATUS_YES);
}
else if(role.equals("DECLINED")){
user.setStatusSelect(ICalendarUserRepository.STATUS_NO);
}
}
return user;
}
示例14: convertRequiredAttendees
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
public Set<Attendee> convertRequiredAttendees(NonEmptyArrayOfAttendeesType attendees,ResponseTypeType myResponseType){
return convertAttendees(attendees, myResponseType, Role.REQ_PARTICIPANT);
}
示例15: convertOptionalAttendees
import net.fortuna.ical4j.model.property.Attendee; //导入依赖的package包/类
public Set<Attendee> convertOptionalAttendees(NonEmptyArrayOfAttendeesType attendees,ResponseTypeType myResponseType){
return convertAttendees(attendees, myResponseType, Role.OPT_PARTICIPANT);
}