Class UCSBOrganizationsController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBOrganizationsController
@RequestMapping("/api/ucsborganizations")
@RestController
public class UCSBOrganizationsController
extends ApiController
This is a REST controller for UCSBOrganizations
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList all UCSB organizationsdeleteUCSBOrganization(String orgCode) Delete a UCSB organizationgetUCSBOrganizationById(String orgCode) Get a UCSB organization by IDpostUCSBOrganization(String orgCode, String orgTranslationShort, String orgTranslation, boolean inactive) Create a new UCSB organizationupdateUCSBOrganization(String orgCode, UCSBOrganizations incoming) Update a UCSB organizationMethods inherited from class ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBOrganizationsController
public UCSBOrganizationsController()
-
-
Method Details
-
allUCSBOrganizations
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/all") public Iterable<UCSBOrganizations> allUCSBOrganizations()List all UCSB organizations- Returns:
- an iterable of UCSBOrganizations
-
getUCSBOrganizationById
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("") public UCSBOrganizations getUCSBOrganizationById(@RequestParam String orgCode) Get a UCSB organization by ID- Parameters:
orgCode- the organization code- Returns:
- the UCSB organization
-
updateUCSBOrganization
@PreAuthorize("hasRole('ROLE_ADMIN')") @PutMapping("") public UCSBOrganizations updateUCSBOrganization(@RequestParam String orgCode, @RequestBody UCSBOrganizations incoming) Update a UCSB organization- Parameters:
orgCode- the organization code to updateincoming- the updated organization data- Returns:
- the updated organization
-
postUCSBOrganization
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/post") public UCSBOrganizations postUCSBOrganization(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive) throws com.fasterxml.jackson.core.JsonProcessingException Create a new UCSB organization- Parameters:
orgCode- the organization codeorgTranslationShort- the short organization nameorgTranslation- the full organization nameinactive- whether the organization is inactive- Returns:
- the saved UCSB organization
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
deleteUCSBOrganization
-