public String getAttendeeString(Appointment appointment) {

    String attendeeString = "";

    Reservation raplaReservation = appointment.getReservation();
    Allocatable[] raplaPersons = raplaReservation.getPersons();

    for (int i = 0; i < raplaPersons.length; i++) {
      if (!isReserved(raplaPersons[i], appointment)) continue;

      attendeeString += raplaPersons[i].getName(raplaLocale.getLocale());
      attendeeString = attendeeString.trim();

      if (i != raplaPersons.length - 1) {
        attendeeString += ", ";
      } else {
        attendeeString = " [" + attendeeString + "]";
      }
    }

    return attendeeString;
  }
예제 #2
0
  public List<Row> getAttributes(
      Reservation reservation,
      LinkController controller,
      User user,
      boolean excludeAdditionalInfos) {
    ArrayList<Row> att = new ArrayList<Row>();
    att.addAll(getClassificationAttributes(reservation, excludeAdditionalInfos, controller));
    User owner = reservation.getOwner();
    final Locale locale = getLocale();
    if (owner != null) {
      final String ownerName = owner.getName(locale);
      String ownerText = encode(ownerName);
      if (controller != null) ownerText = controller.createLink(owner, ownerName);
      att.add(new Row(getString("reservation.owner"), ownerText));
    }
    User lastChangeBy = reservation.getLastChangedBy();
    if (lastChangeBy != null && (owner == null || !lastChangeBy.equals(owner))) {
      final String lastChangedName = lastChangeBy.getName(locale);
      String lastChangeByText = encode(lastChangedName);
      if (controller != null)
        lastChangeByText = controller.createLink(lastChangeBy, lastChangedName);
      att.add(new Row(getString("last_changed_by"), lastChangeByText));
    }

    Allocatable[] resources = reservation.getResources();
    String resourceList = allocatableList(reservation, resources, user, controller);
    if (resourceList.length() > 0) {
      att.add(new Row(getString("resources"), resourceList));
    }
    Allocatable[] persons = reservation.getPersons();
    String personList = allocatableList(reservation, persons, user, controller);
    if (personList.length() > 0) {
      att.add(new Row(getString("persons"), personList));
    }
    return att;
  }