/** * Prüfe, ob eine Ressource für ein bestimmten Appointment reserviert ist. * * @param alloc * @param when * @return <code>true</code>, wenn die Ressource reserviert ist. <code>false</code> sonst */ private boolean isReserved(Allocatable alloc, Appointment when) { Reservation reservation = when.getReservation(); Appointment[] restrictions = reservation.getRestriction(alloc); for (int restIt = 0, restLen = restrictions.length; restIt < restLen; restIt++) { if (when.equals(restrictions[restIt])) return true; } return (restrictions.length == 0); }
/** * Fügt einem iCal-Event den Termin-Namen aus dem übergebenen Appointment-Objekt hinzu. * * @param appointment */ private void addEventNameToEvent(Appointment appointment, PropertyList properties) { Reservation reservation = appointment.getReservation(); final Locale locale = raplaLocale.getLocale(); String eventDescription = NameFormatUtil.getExportName(appointment, locale); if (reservation .getClassification() .getType() .getAnnotation(DynamicTypeAnnotations.KEY_NAME_FORMAT_EXPORT) == null) { eventDescription += getAttendeeString(appointment); } properties.add(new Summary(eventDescription)); }
private void addDescriptionToEvent(Appointment appointment, PropertyList properties) { Reservation reservation = appointment.getReservation(); String eventDescription; if (reservation .getClassification() .getType() .getAnnotation(DynamicTypeAnnotations.KEY_DESCRIPTION_FORMAT_EXPORT) != null) { eventDescription = reservation.format( raplaLocale.getLocale(), DynamicTypeAnnotations.KEY_DESCRIPTION_FORMAT_EXPORT, appointment); } else { eventDescription = null; } if (eventDescription != null) { properties.add(new Description(eventDescription)); } }
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; }