/** * add attenddees if system property ical4j.validation.relaxed is set ony * * @param appointment * @param properties */ private void addAttendees( Appointment appointment, PropertyList properties, boolean doExportAsMeeting, String exportAttendeesParticipationStatus) { if (!doExportAsMeeting) return; Allocatable[] persons = appointment.getReservation().getAllocatablesFor(appointment); for (Allocatable person : persons) { if (!person.isPerson()) { continue; } String email = null; Attribute attr = person.getClassification().getAttribute(exportAttendeesAttribute); if (attr != null && person.getClassification().getValue(attr) != null) email = person.getClassification().getValue(attr).toString().trim(); // determine if person has email attribute if (email != null && email.length() > 0) { try { Attendee attendee = new Attendee(new URI(email)); attendee.getParameters().add(Role.REQ_PARTICIPANT); attendee.getParameters().add(new Cn(person.getName(raplaLocale.getLocale()))); attendee.getParameters().add(new PartStat(exportAttendeesParticipationStatus)); properties.add(attendee); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } } } }
/** * 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, List<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; }