/**
   * 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;
  }
 public void addAttendees(String attendees, Rfc822Validator validator) {
   final LinkedHashSet<Rfc822Token> addresses =
       EditEventHelper.getAddressesFromList(attendees, validator);
   synchronized (this) {
     for (final Rfc822Token address : addresses) {
       final Attendee attendee = new Attendee(address.getName(), address.getAddress());
       if (TextUtils.isEmpty(attendee.mName)) {
         attendee.mName = attendee.mEmail;
       }
       addAttendee(attendee);
     }
   }
 }
Esempio n. 4
0
 /**
  * Called by the {@link org.yestech.event.multicaster.IEventMulticaster} when the Event is fired.
  *
  * @param occasionRsvpEvent Event registered
  * @param result The result to return
  */
 @Override
 public void handle(OccasionRsvpEvent occasionRsvpEvent, ResultReference<Occasion> result) {
   OccasionRequest request = occasionRsvpEvent.getType();
   String occasionGuid = request.getOccasionGuid();
   String attendeeGuid = request.getAttendeeUserGuid();
   Attendee attendee = occasionDao.loadAttendeeByGuidAndOccasionGuid(occasionGuid, attendeeGuid);
   if (attendee != null) {
     attendee.setAttendingStatus(request.getAttendingStatus());
     attendee.setAcknowledged(true);
     occasionDao.update(attendee);
   } else {
     // check to see if occasion is open...
     Occasion occasion = occasionDao.loadByGuid(occasionGuid);
     if (OccasionType.OPEN.equals(occasion.getOccasionType())) {
       User user = userDao.loadUserByGuid(attendeeGuid);
       attendee = new Attendee();
       Utils.applyGuid(attendee);
       PersistenceUtil.setDates(attendee);
       attendee.setAttendingStatus(request.getAttendingStatus());
       attendee.setBbxUserGuid(attendeeGuid);
       attendee.setAttendeeSource(AttendeeSource.BBOX_NETWORK);
       attendee.setBbxUserName(user.getUsername());
       attendee.setEmail(user.getEmail());
       attendee.setAcknowledged(true);
       List<Occasion> occasions = attendee.getOccasions();
       if (occasions == null) {
         occasions = newArrayList();
         attendee.setOccasions(occasions);
       }
       occasions.add(occasion);
       List<Attendee> attendees = occasion.getAttendees();
       if (attendees == null) {
         attendees = newArrayList();
         occasion.setAttendees(attendees);
       }
       attendees.add(attendee);
       occasionDao.save(occasion);
     }
   }
 }