Class ExhibitService


  • @Service
    public class ExhibitService
    extends Object
    Class represent service which is responsible for exhibits operations
    • Constructor Detail

      • ExhibitService

        public ExhibitService()
    • Method Detail

      • getExhibitsOfInstitution

        public List<ExhibitVM> getExhibitsOfInstitution​(Long institutionId)
        Gets all exhibits of given institution
        Parameters:
        institutionId - institution id
        Returns:
        all exhibits of given institution
      • deleteExhibit

        public void deleteExhibit​(Long exhibitId,
                                  User user)
        Deletes exhibit if is managed by given user
        Parameters:
        exhibitId - exhibit id
        user - user
      • deleteExhibit

        public void deleteExhibit​(Exhibit exhibit)
        Deletes given exhibit from db and its images from fs
        Parameters:
        exhibit - exhibit
      • saveExhibit

        public void saveExhibit​(Exhibit exhibit,
                                User user)
        Saves new exhibit to user's institution
        Parameters:
        exhibit - new exhibit
        user - owner of an institution
      • saveExhibit

        public void saveExhibit​(Exhibit exhibit,
                                Long institutionId)
        Saves new exhibit to institution defined by its id
        Parameters:
        exhibit - new exhibit
        institutionId - id of institution managing exhibit
      • updateExhibitImage

        public String updateExhibitImage​(Long exhibitId,
                                         ImageVM imageVM,
                                         User user)
        Updates exhibit image and returns its new name
        Parameters:
        exhibitId - updated exhibit id
        imageVM - encoded image
        user - manager of given exhibit
        Returns:
        new image name
      • updateExhibitInfoLabel

        public String updateExhibitInfoLabel​(Long exhibitId,
                                             ImageVM imageVM,
                                             User user)
        Updates exhibit info label image and returns its new name
        Parameters:
        exhibitId - updated exhibit id
        imageVM - encoded info label image
        user - manager of given exhibit
        Returns:
        new info label name
      • updateExhibit

        public void updateExhibit​(Long exhibitId,
                                  UpdateExhibitVM updateExhibitVM,
                                  User user)
        Updates exhibit information
        Parameters:
        exhibitId - updated exhibit id
        updateExhibitVM - updated information
        user - manager of given exhibit
      • getAllExhibitsOfUsersInstitution

        public List<ExhibitVM> getAllExhibitsOfUsersInstitution​(User user)
        Gets all the exhibits of user's institution
        Parameters:
        user - owner of an institution
        Returns:
        all exhibits of user's institution
      • getExhibitsApproveTranslations

        public ExhibitsLanguagesVM getExhibitsApproveTranslations​(User user)
        Gets exhibits and allowed languages of user's institution
        Parameters:
        user - owner of institution
        Returns:
        exhibits and allowed language
      • getExhibit

        public ExhibitVM getExhibit​(Long exhibitId,
                                    User user)
        Gets an exhibit defined by its id if is managed by given user
        Parameters:
        exhibitId - exhibit id
        user - manager of exhibit
        Returns:
        exhibit
      • getExhibitQRCode

        public String getExhibitQRCode​(Long exhibitId,
                                       User user)
        Gets base64 encoded QR code for given exhibit
        Parameters:
        exhibitId - exhibit id
        user - institution manager
        Returns:
        base64 encoded QR code
      • getExhibitsTranslate

        public ExhibitsLanguagesVM getExhibitsTranslate​(Long institutionId)
        Gets exhibits and allowed languages of an institution defined by its id
        Parameters:
        institutionId - institution id
        Returns:
        exhibits and allowed language