Class LocationController
- java.lang.Object
-
- cz.zcu.students.cacha.bp_server.controllers.LocationController
-
@RestController @RequestMapping("/location") public class LocationController extends Object
Class represents rest controller which is responsible for all operations connected to managing building, room and show-case
-
-
Constructor Summary
Constructors Constructor Description LocationController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericResponse
deleteBuilding(Long buildingId, User user)
Deletes building based on its idGenericResponse
deleteRoom(Long roomId, User user)
Deletes room based on its idGenericResponse
deleteShowcase(Long showcaseId, User user)
Deletes showcase based on its idList<BuildingVM>
getAllBuildings(Long institutionId)
Gets all buildings of institution based on its idList<BuildingVM>
getAllBuildingsOfUsersInstitution(User user)
Gets all buildings of logged in user's institutionList<RoomVM>
getAllRooms(Long buildingId)
Gets all rooms of building based on its idList<ShowcaseVM>
getAllShowcases(Long roomId)
Gets all showcases of room based on its idBuildingVM
getBuilding(Long buildingId, User user)
Gets building based on its idRoomVM
getRoom(Long roomId, User user)
Gets room based on its idShowcaseVM
getShowcase(Long showcaseId, User user)
Gets showcase based on its idGenericResponse
saveBuilding(@Valid Building building, User user)
Saves new building to logged in user's institutionGenericResponse
saveRoom(@Valid Room room, Long buildingId, User user)
Saves new room to given building defined by idGenericResponse
saveShowcase(@Valid Showcase showcase, Long roomId, User user)
Saves new showcase to given room defined by idGenericResponse
updateBuilding(@Valid Building building, Long buildingId, User user)
Updates building information based on its idGenericResponse
updateRoom(@Valid Room room, Long roomId, User user)
Updates room information based on its idGenericResponse
updateShowcase(@Valid Showcase showcase, Long showcaseId, User user)
Updates showcase information based on its id
-
-
-
Method Detail
-
getAllBuildingsOfUsersInstitution
@GetMapping("/buildings") public List<BuildingVM> getAllBuildingsOfUsersInstitution(User user)
Gets all buildings of logged in user's institution- Parameters:
user
- logged in user- Returns:
- all buildings of logged in user's institution
-
getAllBuildings
@GetMapping("/buildings/all/{institutionId}") public List<BuildingVM> getAllBuildings(@PathVariable Long institutionId)
Gets all buildings of institution based on its id- Parameters:
institutionId
- institution id- Returns:
- all buildings of institution based on its id
-
getBuilding
@GetMapping("/buildings/{buildingId}") public BuildingVM getBuilding(@PathVariable Long buildingId, User user)
Gets building based on its id- Parameters:
buildingId
- building iduser
- logged in user- Returns:
- building based on its id
-
saveBuilding
@PostMapping("/buildings") @ResponseStatus(CREATED) public GenericResponse saveBuilding(@Valid @RequestBody @Valid Building building, User user)
Saves new building to logged in user's institution- Parameters:
building
- buildinguser
- logged in user- Returns:
- message containing whether operation was processed
-
updateBuilding
@PutMapping("/buildings/{buildingId}") public GenericResponse updateBuilding(@Valid @RequestBody @Valid Building building, @PathVariable Long buildingId, User user)
Updates building information based on its id- Parameters:
building
- updated buildingbuildingId
- building iduser
- logged in user- Returns:
- message containing whether operation was processed
-
deleteBuilding
@DeleteMapping("/buildings/{buildingId}") public GenericResponse deleteBuilding(@PathVariable Long buildingId, User user)
Deletes building based on its id- Parameters:
buildingId
- building iduser
- logged in user- Returns:
- message containing whether operation was processed
-
getAllRooms
@GetMapping("/rooms/all/{buildingId}") public List<RoomVM> getAllRooms(@PathVariable Long buildingId)
Gets all rooms of building based on its id- Parameters:
buildingId
- building id- Returns:
- all rooms of building based on its id
-
getRoom
@GetMapping("/rooms/{roomId}") public RoomVM getRoom(@PathVariable Long roomId, User user)
Gets room based on its id- Parameters:
roomId
- room iduser
- logged in user- Returns:
- room based on its id
-
saveRoom
@PostMapping("/rooms/{buildingId}") @ResponseStatus(CREATED) public GenericResponse saveRoom(@Valid @RequestBody @Valid Room room, @PathVariable Long buildingId, User user)
Saves new room to given building defined by id- Parameters:
room
- roombuildingId
- building iduser
- logged in user- Returns:
- message containing whether operation was processed
-
updateRoom
@PutMapping("/rooms/{roomId}") public GenericResponse updateRoom(@Valid @RequestBody @Valid Room room, @PathVariable Long roomId, User user)
Updates room information based on its id- Parameters:
room
- updated roomroomId
- room iduser
- logged in user- Returns:
- message containing whether operation was processed
-
deleteRoom
@DeleteMapping("/rooms/{roomId}") public GenericResponse deleteRoom(@PathVariable Long roomId, User user)
Deletes room based on its id- Parameters:
roomId
- room iduser
- logged in user- Returns:
- message containing whether operation was processed
-
getAllShowcases
@GetMapping("/showcases/all/{roomId}") public List<ShowcaseVM> getAllShowcases(@PathVariable Long roomId)
Gets all showcases of room based on its id- Parameters:
roomId
- room id- Returns:
- all showcases of room based on its id
-
getShowcase
@GetMapping("/showcases/{showcaseId}") public ShowcaseVM getShowcase(@PathVariable Long showcaseId, User user)
Gets showcase based on its id- Parameters:
showcaseId
- showcase iduser
- logged in user- Returns:
- showcase based on its id
-
saveShowcase
@PostMapping("/showcases/{roomId}") @ResponseStatus(CREATED) public GenericResponse saveShowcase(@Valid @RequestBody @Valid Showcase showcase, @PathVariable Long roomId, User user)
Saves new showcase to given room defined by id- Parameters:
showcase
- showcaseroomId
- room iduser
- logged in user- Returns:
- message containing whether operation was processed
-
updateShowcase
@PutMapping("/showcases/{showcaseId}") public GenericResponse updateShowcase(@Valid @RequestBody @Valid Showcase showcase, @PathVariable Long showcaseId, User user)
Updates showcase information based on its id- Parameters:
showcase
- updated showcaseshowcaseId
- showcase iduser
- logged in user- Returns:
- message containing whether operation was processed
-
deleteShowcase
@DeleteMapping("/showcases/{showcaseId}") public GenericResponse deleteShowcase(@PathVariable Long showcaseId, User user)
Deletes showcase based on its id- Parameters:
showcaseId
- showcase iduser
- logged in user- Returns:
- message containing whether operation was processed
-
-