Class UCSBOrganizationController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBOrganizationController

@RequestMapping("/api/ucsborganizations") @RestController public class UCSBOrganizationController extends ApiController
  • Constructor Details

    • UCSBOrganizationController

      public UCSBOrganizationController()
  • Method Details

    • allOrganizations

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBOrganization> allOrganizations()
      This method returns a list of all UCSB organizations.
      Returns:
      a list of all UCSB organizations
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganization getById(@RequestParam(required=false) String id, @RequestParam(required=false) String orgCode)
      This method returns a single UCSB organization. Accepts both `id` and `orgCode` as parameters.
      Parameters:
      id - the id of the UCSB organization
      orgCode - the orgCode of the UCSB organization
      Returns:
      a single UCSB organization
    • postOrganization

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganization postOrganization(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive)
      This method creates a new UCSB organization. Accessible only to users with the role "ROLE_ADMIN".
    • deleteOrganization

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteOrganization(@RequestParam(required=false) String id, @RequestParam(required=false) String orgCode)
      Delete a UCSB organization. Accessible only to users with the role "ROLE_ADMIN". Accepts both `id` and `orgCode` as parameters.
    • updateOrganization

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganization updateOrganization(@RequestParam(required=false) String id, @RequestParam(required=true) String orgCode, @RequestBody @Valid @Valid UCSBOrganization incoming)
      Update a single UCSB organization. Accessible only to users with the role "ROLE_ADMIN". Accepts both `id` and `orgCode` as parameters.