Class UCSBDiningCommonsMenuItemController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBDiningCommonsMenuItemController
@RequestMapping("/api/ucsbdiningcommonsmenuitem")
@RestController
public class UCSBDiningCommonsMenuItemController
extends ApiController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet all records in the table and return as a JSON arraydeleteUCSBDate
(Long id) Delete a single record from the table; use the value passed in as a @RequestParam to do a lookup by id.Get a single record from the table; use the value passed in as a @RequestParam to do a lookup by id.postUcsbDiningCommonsMenuItem
(String diningCommonsCode, String name, String station) Use the data in the input parameters to create a new row in the table and return the data as JSONupdateUCSBDiningCommonsMenuItem
(Long id, @Valid UCSBDiningCommonsMenuItem incoming) Get a single record from the table; use the value passed in as a @RequestParam to do a lookup by id.Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBDiningCommonsMenuItemController
public UCSBDiningCommonsMenuItemController()
-
-
Method Details
-
allUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItem()Get all records in the table and return as a JSON array- Returns:
- an iterable of UCSBDiningCommonsMenuItem
-
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 Use the data in the input parameters to create a new row in the table and return the data as JSON- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
deleteUCSBDate
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDate(@RequestParam Long id) Delete a single record from the table; use the value passed in as a @RequestParam to do a lookup by id. If a matching row is not found, throw an EntityNotFoundException. -
updateUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming) Get a single record from the table; use the value passed in as a @RequestParam to do a lookup by id. If a matching row is found, update that row with the values passed in as a JSON object. If a matching row is not found, throw an EntityNotFoundException. -
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id) Get a single record from the table; use the value passed in as a @RequestParam to do a lookup by id. If a matching row is found, return the row as a JSON object, otherwise throw an EntityNotFoundException.
-