Class ExhibitController
- java.lang.Object
-
- cz.zcu.students.cacha.bp_server.controllers.ExhibitController
-
@RestController @RequestMapping("/exhibits") public class ExhibitController extends Object
Class represents rest controller which is responsible for exhibits operations
-
-
Constructor Summary
Constructors Constructor Description ExhibitController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericResponse
deleteExhibit(Long exhibitId, User user)
Deletes an exhibit based on its idList<ExhibitVM>
getAllExhibitsOfInstitution(Long institutionId)
Gets all exhibits of given institutionList<ExhibitVM>
getAllExhibitsOfUsersInstitution(User user)
Gets all exhibits of logged in user's institutionExhibitVM
getExhibit(Long exhibitId, User user)
Gets exhibit based on its idString
getExhibitQRCode(Long exhibitId, User user)
Gets base64 encoded QR code for given exhibitExhibitsLanguagesVM
getExhibitsApproveTranslations(User user)
Gets exhibits and allowed languages of logged in user insitutionExhibitsLanguagesVM
getExhibitsTranslate(Long institutionId)
Gets exhibits and allowed languages of an institution defined by its idGenericResponse
saveExhibit(@Valid Exhibit exhibit, User user)
Saves new exhibit to logged in user's institutionGenericResponse
saveExhibit(Long institutionId, @Valid Exhibit exhibit)
Saves new exhibit to an institution defined by its idGenericResponse
updateExhibit(Long exhibitId, @Valid UpdateExhibitVM updateExhibitVM, User user)
Updates information of given exhibitGenericResponse
updateExhibitImage(Long exhibitId, @Valid ImageVM imageVM, User user)
Updates the image of given exhibit and returns its new nameGenericResponse
updateExhibitInfoLabel(Long exhibitId, @Valid ImageVM imageVM, User user)
Updates the info label image of given exhibit and returns its new name
-
-
-
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 iduser
- 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 iduser
- 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 iduser
- 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 exhibituser
- 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 exhibitexhibit
- 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 exhibitimageVM
- encoded imageuser
- 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 exhibitimageVM
- encoded info labeluser
- 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 exhibitupdateExhibitVM
- updated exhibit informationuser
- 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
-
-