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

    • 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 update
      incoming - 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 code
      orgTranslationShort - the short organization name
      orgTranslation - the full organization name
      inactive - whether the organization is inactive
      Returns:
      the saved UCSB organization
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteUCSBOrganization

      @PreAuthorize("hasRole('ROLE_ADMIN')") @DeleteMapping("") public Object deleteUCSBOrganization(@RequestParam String orgCode)
      Delete a UCSB organization
      Parameters:
      orgCode - the organization code
      Returns:
      a confirmation message