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 TypeMethodDescriptionTHis method returns a list of all ucsborganizations.deleteCommons
(String orgCode) Delete a ucsborganizations.postOrganizationss
(String orgCode, String orgTranslationShort, String orgTranslation, boolean inactive) This method creates a new ucsborganizations.updateUCSBOrganization
(String orgCode, @Valid UCSBOrganization incoming) Update a single UCSB OrganizationMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBOrganizationsController
public UCSBOrganizationsController()
-
-
Method Details
-
allOrganizations
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBOrganization> allOrganizations()THis method returns a list of all ucsborganizations.- Returns:
- a list of all ucsborganizations
-
postOrganizationss
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganization postOrganizationss(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive) This method creates a new ucsborganizations. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgCode
- the ucsborganizations codeorgTranslationShort
- the ucsborganizations translation shortorgTranslation
- the ucsb organizations translationinactive
- whether or not the ucsb organizations is active- Returns:
- the save ucsborganizations
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganization getById(@RequestParam String orgCode) -
updateUCSBOrganization
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganization updateUCSBOrganization(@RequestParam String orgCode, @RequestBody @Valid @Valid UCSBOrganization incoming) Update a single UCSB Organization- Parameters:
orgCode
- orgCode of the Organization to updateincoming
- the new Organization Item- Returns:
- the updated Organization object
-
deleteCommons
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteCommons(@RequestParam String orgCode) Delete a ucsborganizations. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgCode
- orgCode of the organizations- Returns:
- a message indiciating the organizations was deleted
-