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 UCSBDates
  • Constructor Details

    • UCSBOrganizationController

      public UCSBOrganizationController()
  • Method Details

    • allUCSBOrganizations

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBOrganization> allUCSBOrganizations()
      List all UCSB Organizations
      Returns:
      an iterable of UCSBOrganization
    • getById

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganization postUCSBDate(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive)
      Create a new ucsb organization
      Parameters:
      orgCode - the code of the organization
      orgTranslationShort - shortened version of the organization
      orgTranslation - organization name
      inactive - if the organization is still active or not
      Returns:
      the saved ucsbdate
    • deleteCommons

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteCommons(@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 commons was deleted
    • updateOrganization

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