コード例 #1
0
  /**
   * Fügt einem iCal-Event den Ort aus dem übergebenen Appointment-Objekt hinzu.
   *
   * @param appointment
   */
  private void addLocationToEvent(Appointment appointment, PropertyList properties) {
    Allocatable[] allocatables = appointment.getReservation().getAllocatablesFor(appointment);
    StringBuffer buffer = new StringBuffer();
    for (Allocatable alloc : allocatables) {
      if (hasLocationType) {
        if (alloc.getClassification().getType().getAnnotation(DynamicTypeAnnotations.KEY_LOCATION)
            == null) {
          continue;
        }
      } else if (alloc.isPerson()) {
        continue;
      }
      if (buffer.length() > 0) {
        buffer.append(", ");
      }
      buffer.append(alloc.getName(raplaLocale.getLocale()));
    }

    properties.add(new Location(buffer.toString()));
  }
コード例 #2
0
  /**
   * 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);
        }
      }
    }
  }