Class UCSBOrganizationController

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

@RequestMapping("/api/UCSBOrganization") @RestController public class UCSBOrganizationController extends ApiController
This is a REST controller for UCSBOrganization
  • 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 UCSBOrganizations.
      Returns:
      a list of all UCSBOrganizations
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganization getById(@RequestParam String orgCode)
      This method returns a single UCSBOrganization.
      Parameters:
      orgCode - the org code of the organization
      Returns:
      a single UCSBOrganization
    • 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 UCSBOrganization. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      orgCode - the org code of the organization
      orgTranslationShort - short translation of the org name
      orgTranslation - full translation of the org name
      inactive - whether or not the organization is inactive
      Returns:
      the saved UCSBOrganization
    • updateOrganization

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganization updateOrganization(@RequestParam String orgCode, @RequestBody @Valid @Valid UCSBOrganization incoming)
      Update a single UCSBOrganization. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      orgCode - the org code of the organization
      incoming - the new organization contents
      Returns:
      the updated UCSBOrganization
    • deleteOrganization

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteOrganization(@RequestParam String orgCode)
      Delete a UCSBOrganization. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      orgCode - the org code of the organization
      Returns:
      a message indicating the organization was deleted