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<UCSBOrgs> allOrganizations()
      THis method returns a list of all ucsborgs.
      Returns:
      a list of all ucsborgs
    • postOrganizations

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrgs postOrganizations(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive)
      This method creates a new organization. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      orgCode -
      orgTranslationShort -
      orgTranslation -
      inactive -
      Returns:
      the save ucsb orgs
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrgs getById(@RequestParam String orgCode)
      This method returns a single ucsborganization.
      Parameters:
      orgCode - code of the ucsborganization
      Returns:
      a single ucsborganization
    • deleteOrganization

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrgs updateOrgs(@RequestParam String orgCode, @RequestBody @Valid @Valid UCSBOrgs incoming)