Class LocationService


  • @Service
    public class LocationService
    extends Object
    Class represent service which is responsible for location (building, room and show-case) operations
    • Constructor Detail

      • LocationService

        public LocationService()
    • Method Detail

      • getAllBuildingsOfUsersInstitution

        public List<BuildingVM> getAllBuildingsOfUsersInstitution​(User user)
        Gets all buildings of user's institution
        Parameters:
        user - owner of an institution
        Returns:
        all buildings of user's institution
      • getAllBuildings

        public List<BuildingVM> getAllBuildings​(Long institutionId)
        Gets all buildings of institution defined by its id
        Parameters:
        institutionId - institution id
        Returns:
        all buildings of institution defined by its id
      • getBuilding

        public BuildingVM getBuilding​(Long buildingId,
                                      User user)
        Gets details about building defined by its id
        Parameters:
        buildingId - building id
        user - owner of an institution
        Returns:
        details about building defined by its id
      • saveBuilding

        public void saveBuilding​(Building building,
                                 User user)
        Saves new building to logged in user's institution
        Parameters:
        building - new building
        user - institution manager
      • updateBuilding

        public void updateBuilding​(Building updatedBuilding,
                                   Long buildingId,
                                   User user)
        Updates building with new information based on its id
        Parameters:
        updatedBuilding - updated building
        buildingId - building id
        user - institution manager
      • deleteBuilding

        @Transactional
        public void deleteBuilding​(Long buildingId,
                                   User user)
        Deletes building by its id
        Parameters:
        buildingId - building id
        user - institution manager
      • getAllRooms

        public List<RoomVM> getAllRooms​(Long buildingId)
        Gets all rooms of building defined by id
        Parameters:
        buildingId - building id
        Returns:
        all rooms of building defined by id
      • getRoom

        public RoomVM getRoom​(Long roomId,
                              User user)
        Gets room details by its id
        Parameters:
        roomId - room id
        user - institution manager
        Returns:
        room details
      • saveRoom

        public void saveRoom​(Room room,
                             Long buildingId,
                             User user)
        Saves new room to building defined by id
        Parameters:
        room - new room
        buildingId - building id
        user - institution manager
      • updateRoom

        public void updateRoom​(Room updatedRoom,
                               Long roomId,
                               User user)
        Updates room defined by id with new information
        Parameters:
        updatedRoom - updated room
        roomId - room id
        user - institution manager
      • deleteRoom

        @Transactional
        public void deleteRoom​(Long roomId,
                               User user)
        Deletes room by its id
        Parameters:
        roomId - room id
        user - institution manager
      • getAllShowcases

        public List<ShowcaseVM> getAllShowcases​(Long roomId)
        Gets all showcases of room defined by id
        Parameters:
        roomId - room id
        Returns:
        all showcases of room defined by id
      • getShowcase

        public ShowcaseVM getShowcase​(Long showcaseId,
                                      User user)
        Gets showcase details by its id
        Parameters:
        showcaseId - showcase id
        user - institution manager
        Returns:
        showcase details
      • saveShowcase

        public void saveShowcase​(Showcase showcase,
                                 Long roomId,
                                 User user)
        Saves new showcase to room defined by id
        Parameters:
        showcase - new showcase
        roomId - room id
        user - institution manager
      • updateShowcase

        public void updateShowcase​(Showcase updatedShowcase,
                                   Long showcaseId,
                                   User user)
        Updates showcase defined by id with new information
        Parameters:
        updatedShowcase - updated showcase
        showcaseId - showcase id
        user - institution manager
      • deleteShowcase

        @Transactional
        public void deleteShowcase​(Long showcaseId,
                                   User user)
        Deletes showcase by its id
        Parameters:
        showcaseId - showcase id
        user - institution manager