Class InstitutionService


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

      • InstitutionService

        public InstitutionService()
    • Method Detail

      • getInstitutions

        public List<InstitutionVM> getInstitutions()
        Gets all institutions
        Returns:
        all institutions
      • saveInstitution

        @Transactional
        public void saveInstitution​(Institution institution,
                                    User user)
        Saves institution with given user as a manager
        Parameters:
        institution - new institution
        user - institution manager
      • getAllowedLanguages

        public AllowedLanguagesVM getAllowedLanguages​(User user)
        Gets the chosen and possible languages of institution
        Parameters:
        user - institution owner
        Returns:
        chosen and possible languages
      • addLanguage

        public void addLanguage​(Long languageId,
                                User user)
        Adds language to institution
        Parameters:
        languageId - language id to add
        user - institution owner
      • updateImage

        public String updateImage​(ImageVM imageVM,
                                  User user)
        Updates institution image
        Parameters:
        imageVM - encoded image
        user - logged in user
        Returns:
        new image name
      • updateInstitution

        public void updateInstitution​(UpdateInstitutionVM institution,
                                      User user)
        Updates institution information
        Parameters:
        institution - updated institution
        user - logged in user
      • getMyInstitution

        public InstitutionVM getMyInstitution​(User user)
        Gets user's institution
        Parameters:
        user - owner
        Returns:
        user's institution
      • addInstitutionManager

        public void addInstitutionManager​(EmailVM emailVM,
                                          User user)
        Adds new institution manager by sending credentials of a new manager account to given email
        Parameters:
        emailVM - email of a new institution manager
        user - institution manager
      • deleteMyInstitution

        public void deleteMyInstitution​(User user)
        Deletes user's institution
        Parameters:
        user - institution manager
      • deleteInstitution

        @Transactional
        public void deleteInstitution​(Institution institution)
        Deletes given institution
        Parameters:
        institution - institution to delete
      • getInstitutionsOrdered

        public List<InstitutionVM> getInstitutionsOrdered​(CoordinatesVM coordinates)
        Gets all institutions ordered relative to given coordinates
        Parameters:
        coordinates - coordinates
        Returns:
        ordered institutions