Class Room
java.lang.Object
de.gustavblass.fsu.fmi.roombooking.model.room.Room
- All Implemented Interfaces:
Identified
- Direct Known Subclasses:
ConferenceRoom, QuietStudyRoom
Represents a room in the FMI building at Inselplatz.
The table column type determines whether a Room is a ConferenceRoom or a QuietStudyRoom.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate @Nullable AccessibilityHow well this Room is suited for mobility-impaired users.private @Range(from=1L,to=2147483647L) intHow many seats there are, i.e.private final @NonNull Set<IndividualEquipment> TheIndividualEquipmentsuitable for use by one person each that is available in this Room.private @Nullable IntegerThe number of the floor thisRoomis to be found on, if it is located in a multi-storey building.private @NonNull LongIdentifies this Room uniquely.private @Nullable StringUseful information about this Room, possibly displayed to end users when placing aReservation.private @NonNull StringHuman-friendly identifier of the room.private final @NonNull Set<Reservation> The Reservations that are associated with this Room. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIndividualEquipment(@NonNull IndividualEquipment equipment) Replaces theIndividualEquipmentinequipmentthat has same type as the given equipment with the given equipment.voidaddReservation(@NonNull Reservation reservation) Inserts the givenReservationinto thereservationsset.@NonNull Optional<Accessibility> getFloor()@NonNull Set<IndividualEquipment> @NonNull Optional<IndividualEquipment> getIndividualEquipment(@NonNull IndividualEquipmentType type) getNotes()@NonNull Set<Reservation> Returns a copy of thereservationsset.abstract @NonNull RoomTypegetType()voidremoveAllIndividualEquipment(@NonNull IndividualEquipmentType type) voidremoveAllIndividualEquipment(@NonNull Collection<IndividualEquipment> equipment) Deletes multipleIndividualEquipmentfrom theequipmentset.voidremoveIndividualEquipment(@NonNull IndividualEquipment equipment) Deletes the givenIndividualEquipmentfrom theequipmentset.voidsetCapacity(@Range(from=1L,to=2147483647L) int capacity) Updates thecapacity.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Identified
getId
-
Field Details
-
id
Identifies this Room uniquely. -
floor
-
number
Human-friendly identifier of the room. Usually, this is just a small series of digits (e.g.123,42or13), but it cannot be ruled out that some room numbers include letters. Must not be blank! -
capacity
private @Range(from=1L,to=2147483647L) int capacityHow many seats there are, i.e. how many occupants this Room can accomodate. -
equipment
TheIndividualEquipmentsuitable for use by one person each that is available in this Room. There can only be one IndividualEquipment object perRoomEquipment.type. -
accessibility
How well this Room is suited for mobility-impaired users. -
notes
Useful information about this Room, possibly displayed to end users when placing aReservation. -
reservations
The Reservations that are associated with this Room.
-
-
Constructor Details
-
Room
public Room()Do not use this constructor! It exists solely for Spring Data JPA. -
Room
public Room(@NonNull @Range(from=1L,to=2147483647L) @NonNull Long id, @NotBlank @NonNull @NotBlank @NonNull String number, @Range(from=1L,to=2147483647L) int capacity) throws de.gustavblass.commons.exceptions.IllegalArgumentException - Parameters:
id- Identifies this Room uniquely.number- Human-friendly identifier. Must not be blank!capacity- Number of people that can use this Room simultaneously.- Throws:
de.gustavblass.commons.exceptions.IllegalArgumentException- If the room number is blank.
-
-
Method Details
-
getType
-
setCapacity
public void setCapacity(@Range(from=1L,to=2147483647L) int capacity) throws de.gustavblass.commons.exceptions.IllegalArgumentException Updates thecapacity.- Parameters:
capacity- Number of users that can simultaneously be in this Room. Must be greater than zero.- Throws:
de.gustavblass.commons.exceptions.IllegalArgumentException- If the capacity is smaller than one.
-
addIndividualEquipment
Replaces theIndividualEquipmentinequipmentthat has same type as the given equipment with the given equipment.- Parameters:
equipment- The equipment that shall replace the currently present equipment of the same IndividualEquipment type.
-
addReservation
Inserts the givenReservationinto thereservationsset.- Parameters:
reservation- The new reservation.
-
removeIndividualEquipment
Deletes the givenIndividualEquipmentfrom theequipmentset.- Parameters:
equipment- The IndividualEquipment that shall no longer be available in this Room.
-
removeAllIndividualEquipment
public void removeAllIndividualEquipment(@NonNull @NonNull Collection<IndividualEquipment> equipment) Deletes multipleIndividualEquipmentfrom theequipmentset.- Parameters:
equipment- The IndividualEquipment that shall no longer be present in this Room.
-
removeAllIndividualEquipment
- Parameters:
type- TheIndividualEquipmentTypethat shall no longer be present in this Room.
-
getFloor
-
getIndividualEquipment
- Returns:
- Copy of the
IndividualEquipmentTypepresent in this Room.
-
getIndividualEquipment
@Contract(pure=true) @NonNull public @NonNull Optional<IndividualEquipment> getIndividualEquipment(@NonNull @NonNull IndividualEquipmentType type) Finds theIndividualEquipmentin theequipmentof the givenRoomEquipment.type. Note that there is only one IndividualEquipment object of eachIndividualEquipmentType! You probably do not need to call this method.- Parameters:
type- The IndividualEquipmentType that the returned IndividualEquipment object shall match.- Returns:
- The IndividualEquipment matching the given type, if existent.
-
getReservations
Returns a copy of thereservationsset.- Returns:
- Copy of the Reservations placed for this Room.
-
getAccessibility
- Returns:
- The
accessibilityif known.
-
getNotes
-