Package pl.put.poznan.buildingInfo.rest
Class RoomController
- java.lang.Object
-
- pl.put.poznan.buildingInfo.rest.RoomController
-
@RestController @RequestMapping("/buildings/{buildingId}/{levelId}") public class RoomController extends ObjectKontroler obslugujący operacje CRUD dla pomieszczen (Room) w ramach poziomow (Level) i budynkow (Building). Umozliwia zarządzanie pokojami, w tym ich dodawanie, aktualizowanie, usuwanie i pobieranie. Dodatkowo oferuje metody do obliczania parametrow takich jak powierzchnia, kubatura, moc oświetlenia oraz zuzycie energii dla konkretnego pokoju.
-
-
Constructor Summary
Constructors Constructor Description RoomController(LevelController levelController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RoomaddRoom(Room room, int buildingId, int levelId)Dodaje nowe pomieszczenie do wskazanego poziomu w budynku.voiddeleteRoom(int roomId, int buildingId, int levelId)Usuwa pomieszczenie na podstawie jego identyfikatora.List<Room>getAllRooms(int buildingId, int levelId)Pobiera wszystkie pomieszczenia na wskazanym poziomie w budynku.org.springframework.http.ResponseEntity<Map<String,Object>>getAreaOfRoom(int buildingId, int levelId, int roomId)Pobiera powierzchnie konkretnego pomieszczenia.org.springframework.http.ResponseEntity<Map<String,Object>>getCubeOfRoom(int buildingId, int levelId, int roomId)Pobiera kubature konkretnego pomieszczenia.org.springframework.http.ResponseEntity<Map<String,Object>>getEnergyConsumptionOfBuilding(int buildingId, int levelId, int roomId)Oblicza calkowite zuzycie energii dla konkretnego pomieszczenia.org.springframework.http.ResponseEntity<Map<String,Object>>getLightPowerOfBuilding(int buildingId, int levelId, int roomId)Oblicza calkowitą moc oświetlenia dla konkretnego pomieszczenia.RoomgetRoom(int buildingId, int levelId, int roomId)Pobiera szczegoly konkretnego pomieszczenia na podstawie jego identyfikatora.RoomupdateRoom(int buildingId, int levelId, int roomId, Room updatedRoom)Aktualizuje dane istniejącego pomieszczenia.
-
-
-
Constructor Detail
-
RoomController
@Autowired public RoomController(LevelController levelController)
-
-
Method Detail
-
getAllRooms
@RequestMapping(value="/all-rooms", method=GET, produces="application/json") public List<Room> getAllRooms(@PathVariable int buildingId, @PathVariable int levelId)Pobiera wszystkie pomieszczenia na wskazanym poziomie w budynku.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, z ktorego mają zostac pobrane pomieszczenia- Returns:
- lista pomieszczen znajdujących sie na poziomie
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli poziom o podanym identyfikatorze nie istnieje
-
addRoom
@RequestMapping(method=POST, consumes="application/json", produces="application/json") public Room addRoom(@RequestBody Room room, @PathVariable int buildingId, @PathVariable int levelId)Dodaje nowe pomieszczenie do wskazanego poziomu w budynku.- Parameters:
room- obiekt pomieszczenia do dodaniabuildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, do ktorego pomieszczenie ma zostac dodane- Returns:
- dodane pomieszczenie
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli pomieszczenie o podanym identyfikatorze juz istnieje
-
updateRoom
@PutMapping("/{roomId}") public Room updateRoom(@PathVariable int buildingId, @PathVariable int levelId, @PathVariable int roomId, @RequestBody Room updatedRoom)Aktualizuje dane istniejącego pomieszczenia.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, w ktorym znajduje sie pomieszczenieroomId- identyfikator pomieszczenia do aktualizacjiupdatedRoom- zaktualizowane dane pomieszczenia- Returns:
- zaktualizowane pomieszczenie
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli pomieszczenie o podanym identyfikatorze nie istnieje
-
deleteRoom
@DeleteMapping("/{roomId}") public void deleteRoom(@PathVariable int roomId, @PathVariable int buildingId, @PathVariable int levelId)Usuwa pomieszczenie na podstawie jego identyfikatora.- Parameters:
roomId- identyfikator pomieszczenia do usunieciabuildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, w ktorym znajduje sie pomieszczenie- Throws:
org.springframework.web.server.ResponseStatusException- jeśli pomieszczenie o podanym identyfikatorze nie istnieje
-
getRoom
@RequestMapping(value="/{roomId}", method=GET, produces="application/json") public Room getRoom(@PathVariable int buildingId, @PathVariable int levelId, @PathVariable int roomId)Pobiera szczegoly konkretnego pomieszczenia na podstawie jego identyfikatora.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, w ktorym znajduje sie pomieszczenieroomId- identyfikator pomieszczenia- Returns:
- szczegoly pomieszczenia
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli pomieszczenie o podanym identyfikatorze nie istnieje
-
getAreaOfRoom
@RequestMapping(value="/{roomId}/area", method=GET, produces="application/json") public org.springframework.http.ResponseEntity<Map<String,Object>> getAreaOfRoom(@PathVariable int buildingId, @PathVariable int levelId, @PathVariable int roomId)Pobiera powierzchnie konkretnego pomieszczenia.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, w ktorym znajduje sie pomieszczenieroomId- identyfikator pomieszczenia- Returns:
- powierzchnia pomieszczenia (w metrach kwadratowych)
-
getCubeOfRoom
@RequestMapping(value="/{roomId}/cube", method=GET, produces="application/json") public org.springframework.http.ResponseEntity<Map<String,Object>> getCubeOfRoom(@PathVariable int buildingId, @PathVariable int levelId, @PathVariable int roomId)Pobiera kubature konkretnego pomieszczenia.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, w ktorym znajduje sie pomieszczenieroomId- identyfikator pomieszczenia- Returns:
- kubatura pomieszczenia (w metrach sześciennych)
-
getLightPowerOfBuilding
@RequestMapping(value="/{roomId}/light-power", method=GET, produces="application/json") public org.springframework.http.ResponseEntity<Map<String,Object>> getLightPowerOfBuilding(@PathVariable int buildingId, @PathVariable int levelId, @PathVariable int roomId)Oblicza calkowitą moc oświetlenia dla konkretnego pomieszczenia.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, w ktorym znajduje sie pomieszczenieroomId- identyfikator pomieszczenia- Returns:
- calkowita moc oświetlenia pomieszczenia (w watach)
-
getEnergyConsumptionOfBuilding
@RequestMapping(value="/{roomId}/energy-consumption", method=GET, produces="application/json") public org.springframework.http.ResponseEntity<Map<String,Object>> getEnergyConsumptionOfBuilding(@PathVariable int buildingId, @PathVariable int levelId, @PathVariable int roomId)Oblicza calkowite zuzycie energii dla konkretnego pomieszczenia.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, w ktorym znajduje sie pomieszczenieroomId- identyfikator pomieszczenia- Returns:
- calkowite zuzycie energii pomieszczenia (w kilowatogodzinach)
-
-