Package pl.put.poznan.buildingInfo.rest
Class LevelController
- java.lang.Object
-
- pl.put.poznan.buildingInfo.rest.LevelController
-
@RestController @RequestMapping("/buildings/{buildingId}") public class LevelController extends ObjectKontroler obslugujący operacje CRUD dla poziomow (Level) w ramach budynkow (Building). Umozliwia zarządzanie poziomami w budynkach, w tym ich dodawanie, usuwanie i pobieranie, a takze wykonywanie obliczen takich jak sumaryczna powierzchnia, kubatura, moc oświetlenia oraz zuzycie energii na poziomach. Wszystkie operacje są wykonywane w kontekście konkretnego budynku, ktorego identyfikator jest przekazywany jako cześc ściezki API.
-
-
Constructor Summary
Constructors Constructor Description LevelController(BuildingController buildingController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeveladdLevel(Level level, int buildingId)Dodaje nowy poziom do wskazanego budynku.voiddeleteLevel(int buildingId, int levelId)List<Level>getAllLevels(int buildingId)Pobiera wszystkie poziomy (levels) dla konkretnego budynku.org.springframework.http.ResponseEntity<Map<String,Object>>getAreaOfLevel(int buildingId, int levelId)Oblicza calkowitą powierzchnie dla konkretnego poziomu w danym budynku.org.springframework.http.ResponseEntity<Map<String,Object>>getCubeOfLevel(int buildingId, int levelId)Oblicza calkowitą kubature dla konkretnego poziomu w danym budynku.org.springframework.http.ResponseEntity<Map<String,Object>>getEnergyConsumptionOfLevel(int buildingId, int levelId)Oblicza calkowite zuzycie energii na ogrzewanie dla konkretnego poziomu w danym budynku.LevelgetLevel(int buildingId, int levelId)Pobiera szczegoly konkretnego poziomu na podstawie jego identyfikatora i identyfikatora budynku.org.springframework.http.ResponseEntity<Map<String,Object>>getLightPowerOfLevel(int buildingId, int levelId)Oblicza calkowitą moc oświetlenia dla konkretnego poziomu w danym budynku.LevelupdateLevel(int buildingId, int levelId, Level updatedLevel)Aktualizuje dane istniejącego poziomu.
-
-
-
Constructor Detail
-
LevelController
@Autowired public LevelController(BuildingController buildingController)
-
-
Method Detail
-
getAllLevels
@RequestMapping(value="/all-levels", method=GET, produces="application/json") public List<Level> getAllLevels(@PathVariable int buildingId)Pobiera wszystkie poziomy (levels) dla konkretnego budynku.- Parameters:
buildingId- identyfikator budynku, ktorego poziomy mają zostac pobrane- Returns:
- lista wszystkich poziomow w danym budynku
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli budynek o podanym identyfikatorze nie istnieje
-
addLevel
@RequestMapping(method=POST, consumes="application/json", produces="application/json") public Level addLevel(@RequestBody Level level, @PathVariable int buildingId)Dodaje nowy poziom do wskazanego budynku.- Parameters:
level- obiekt poziomu do dodaniabuildingId- identyfikator budynku, do ktorego poziom ma zostac dodany- Returns:
- dodany poziom
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli poziom o podanym identyfikatorze juz istnieje w budynku
-
updateLevel
@PutMapping("/{levelId}") public Level updateLevel(@PathVariable int buildingId, @PathVariable int levelId, @RequestBody Level updatedLevel)Aktualizuje dane istniejącego poziomu.- Parameters:
buildingId- identyfikator budynku do w ktorym znajduje sie poziom do aktualizacjilevelId- identyfikator poziomu do aktualizacjiupdatedLevel- zaktualizowane dane poziomu- Returns:
- zaktualizowany budynek
-
deleteLevel
@DeleteMapping("/{levelId}") public void deleteLevel(@PathVariable int buildingId, @PathVariable int levelId)
-
getLevel
@RequestMapping(value="/{levelId}", method=GET, produces="application/json") public Level getLevel(@PathVariable int buildingId, @PathVariable int levelId)Pobiera szczegoly konkretnego poziomu na podstawie jego identyfikatora i identyfikatora budynku.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu do pobrania- Returns:
- szczegoly poziomu
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli poziom o podanym identyfikatorze nie istnieje w budynku
-
getAreaOfLevel
@RequestMapping(value="/{levelId}/area", method=GET, produces="application/json") public org.springframework.http.ResponseEntity<Map<String,Object>> getAreaOfLevel(@PathVariable int buildingId, @PathVariable int levelId)Oblicza calkowitą powierzchnie dla konkretnego poziomu w danym budynku.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, dla ktorego powierzchnia ma zostac obliczona- Returns:
- calkowita powierzchnia poziomu w metrach kwadratowych
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli poziom o podanym identyfikatorze nie istnieje
-
getCubeOfLevel
@RequestMapping(value="/{levelId}/cube", method=GET, produces="application/json") public org.springframework.http.ResponseEntity<Map<String,Object>> getCubeOfLevel(@PathVariable int buildingId, @PathVariable int levelId)Oblicza calkowitą kubature dla konkretnego poziomu w danym budynku.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, dla ktorego kubatura ma zostac obliczona- Returns:
- calkowita kubatura poziomu w metrach sześciennych
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli poziom o podanym identyfikatorze nie istnieje
-
getLightPowerOfLevel
@RequestMapping(value="/{levelId}/light-power", method=GET, produces="application/json") public org.springframework.http.ResponseEntity<Map<String,Object>> getLightPowerOfLevel(@PathVariable int buildingId, @PathVariable int levelId)Oblicza calkowitą moc oświetlenia dla konkretnego poziomu w danym budynku.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, dla ktorego moc oświetlenia ma zostac obliczona- Returns:
- calkowita moc oświetlenia poziomu w watach
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli poziom o podanym identyfikatorze nie istnieje
-
getEnergyConsumptionOfLevel
@RequestMapping(value="/{levelId}/energy-consumption", method=GET, produces="application/json") public org.springframework.http.ResponseEntity<Map<String,Object>> getEnergyConsumptionOfLevel(@PathVariable int buildingId, @PathVariable int levelId)Oblicza calkowite zuzycie energii na ogrzewanie dla konkretnego poziomu w danym budynku.- Parameters:
buildingId- identyfikator budynku, w ktorym znajduje sie poziomlevelId- identyfikator poziomu, dla ktorego zuzycie energii ma zostac obliczone- Returns:
- calkowite zuzycie energii poziomu w kilowatogodzinach
- Throws:
org.springframework.web.server.ResponseStatusException- jeśli poziom o podanym identyfikatorze nie istnieje
-
-