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 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 code
      orgTranslationShort - the ucsborganizations translation short
      orgTranslation - the ucsb organizations translation
      inactive - 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 update
      incoming - 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