Class UCSBDiningCommonsMenuItemsController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBDiningCommonsMenuItemsController
@RequestMapping("/api/ucsbdiningcommonsmenuitems")
@RestController
public class UCSBDiningCommonsMenuItemsController
extends ApiController
This is a REST controller for UCSBDiningCommonsMenuItem
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList all UCSB Dining Commons Menu ItemsdeleteById
(Long id) Deletes a UCSBDiningCommonsMenuItemGet a single UCSBDiningCommonsMenuItem via IDpostUCSBDiningCommonsMenuItem
(String diningCommonsCode, String name, String station) Create a new UCSBDiningCommonsMenuItemupdateUCSBDiningCommonsMenuItem
(Long id, @Valid UCSBDiningCommonsMenuItem ucsbDiningCommonsMenuItem) Update a single UCSBDiningCommonsMenuItem via diningCommonsCodeMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBDiningCommonsMenuItemsController
public UCSBDiningCommonsMenuItemsController()
-
-
Method Details
-
allUCSBDiningCommonsMenuItems
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItems()List all UCSB Dining Commons Menu Items- Returns:
- an iterable of UCSBDiningCommonsMenuItem
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id) throws EntityNotFoundException Get a single UCSBDiningCommonsMenuItem via ID- Parameters:
id
- the id of the UCSBDiningCommonsMenuItem- Returns:
- a single UCSBDiningCommonsMenuItem
- Throws:
EntityNotFoundException
- if the UCSBDiningCommonsMenuItem is not found
-
updateUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @Valid @RequestBody @Valid UCSBDiningCommonsMenuItem ucsbDiningCommonsMenuItem) Update a single UCSBDiningCommonsMenuItem via diningCommonsCode- Parameters:
id
- the id of the UCSBDiningCommonsMenuItemucsbDiningCommonsMenuItem
- the new UCSBDiningCommonsMenuItem- Returns:
- a single UCSBDiningCommonsMenuItem
-
deleteById
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteById(@RequestParam Long id) throws EntityNotFoundException Deletes a UCSBDiningCommonsMenuItem- Parameters:
id
- the id of the UCSBDiningCommonsMenuItem- Throws:
EntityNotFoundException
- if the UCSBDiningCommonsMenuItem is not found
-
postUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDiningCommonsMenuItem postUCSBDiningCommonsMenuItem(@RequestParam String diningCommonsCode, @RequestParam String name, @RequestParam String station) throws com.fasterxml.jackson.core.JsonProcessingException Create a new UCSBDiningCommonsMenuItem- Parameters:
diningCommonsCode
- code of the UCSBDiningCommonsname
- name of the UCSBDiningCommonsstation
- station of the UCSBDiningCommons- Returns:
- the created UCSBDiningCommonsMenuItem
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-