Class ExhibitController


  • @RestController
    @RequestMapping("/exhibits")
    public class ExhibitController
    extends Object
    Class represents rest controller which is responsible for exhibits operations
    • Constructor Detail

      • ExhibitController

        public ExhibitController()
    • Method Detail

      • getAllExhibitsOfInstitution

        @GetMapping("/all/{institutionId}")
        public List<ExhibitVM> getAllExhibitsOfInstitution​(@PathVariable
                                                           Long institutionId)
        Gets all exhibits of given institution
        Parameters:
        institutionId - institution id
        Returns:
        all exhibits of given institution
      • getAllExhibitsOfUsersInstitution

        @GetMapping("/all")
        public List<ExhibitVM> getAllExhibitsOfUsersInstitution​(User user)
        Gets all exhibits of logged in user's institution
        Parameters:
        user - logged in user
        Returns:
        all exhibits of logged in user's institution
      • getExhibit

        @GetMapping("/{exhibitId}")
        public ExhibitVM getExhibit​(@PathVariable
                                    Long exhibitId,
                                    User user)
        Gets exhibit based on its id
        Parameters:
        exhibitId - exhibit id
        user - logged in usr
        Returns:
        exhibit based on its id
      • getExhibitQRCode

        @GetMapping("/{exhibitId}/qrcode")
        public String getExhibitQRCode​(@PathVariable
                                       Long exhibitId,
                                       User user)
        Gets base64 encoded QR code for given exhibit
        Parameters:
        exhibitId - exhibit id
        user - logged in user
        Returns:
        base64 encoded QR code
      • deleteExhibit

        @DeleteMapping("/{exhibitId}")
        public GenericResponse deleteExhibit​(@PathVariable
                                             Long exhibitId,
                                             User user)
        Deletes an exhibit based on its id
        Parameters:
        exhibitId - exhibit id
        user - logged in user
        Returns:
        message containing whether operation was processed
      • saveExhibit

        @PostMapping
        @ResponseStatus(CREATED)
        public GenericResponse saveExhibit​(@Valid @RequestBody
                                           @Valid Exhibit exhibit,
                                           User user)
        Saves new exhibit to logged in user's institution
        Parameters:
        exhibit - new exhibit
        user - logged in user
        Returns:
        message containing whether operation was processed
      • saveExhibit

        @PostMapping("/{institutionId}")
        @ResponseStatus(CREATED)
        public GenericResponse saveExhibit​(@PathVariable
                                           Long institutionId,
                                           @Valid @RequestBody
                                           @Valid Exhibit exhibit)
        Saves new exhibit to an institution defined by its id
        Parameters:
        institutionId - id of an institution managing the exhibit
        exhibit - new exhibit
        Returns:
        message containing whether operation was processed
      • updateExhibitImage

        @PutMapping("/{exhibitId}/updateImage")
        public GenericResponse updateExhibitImage​(@PathVariable
                                                  Long exhibitId,
                                                  @Valid @RequestBody
                                                  @Valid ImageVM imageVM,
                                                  User user)
        Updates the image of given exhibit and returns its new name
        Parameters:
        exhibitId - id of updated exhibit
        imageVM - encoded image
        user - logged in user
        Returns:
        new image name
      • updateExhibitInfoLabel

        @PutMapping("/{exhibitId}/updateInfoLabel")
        public GenericResponse updateExhibitInfoLabel​(@PathVariable
                                                      Long exhibitId,
                                                      @Valid @RequestBody
                                                      @Valid ImageVM imageVM,
                                                      User user)
        Updates the info label image of given exhibit and returns its new name
        Parameters:
        exhibitId - id of updated exhibit
        imageVM - encoded info label
        user - logged in user
        Returns:
        new info label name
      • updateExhibit

        @PutMapping("/{exhibitId}")
        public GenericResponse updateExhibit​(@PathVariable
                                             Long exhibitId,
                                             @Valid @RequestBody
                                             @Valid UpdateExhibitVM updateExhibitVM,
                                             User user)
        Updates information of given exhibit
        Parameters:
        exhibitId - id of updated exhibit
        updateExhibitVM - updated exhibit information
        user - logged in user
        Returns:
        message containing whether operation was processed
      • getExhibitsApproveTranslations

        @GetMapping("/approveTranslations")
        public ExhibitsLanguagesVM getExhibitsApproveTranslations​(User user)
        Gets exhibits and allowed languages of logged in user insitution
        Parameters:
        user - logged in user
        Returns:
        exhibits and allowed language
      • getExhibitsTranslate

        @GetMapping("/translate/{institutionId}")
        public ExhibitsLanguagesVM getExhibitsTranslate​(@PathVariable
                                                        Long institutionId)
        Gets exhibits and allowed languages of an institution defined by its id
        Parameters:
        institutionId - institution id
        Returns:
        exhibits and allowed language