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

    • allOrganizations

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBOrganizations> allOrganizations()
      THis method returns a list of all ucsborganizations.
      Returns:
      a list of all ucsborganizations
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganizations getById(@RequestParam String orgcode)
      This method returns a single UCSBOrganizations.
      Parameters:
      orgcode - orgcode of the UCSBOrganizations
      Returns:
      a single UCSBOrganizations
    • postOrganizations

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganizations postOrganizations(@RequestParam String orgcode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive)
      This method creates a new UCSBOrganizations. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      orgcode - orgcode of the UCSBOrganizations
      orgTranslationShort - orgTranslationShort of the UCSBOrganizations
      orgTranslation - orgTranslation of the UCSBOrganizations
      inactive - whether or not the UCSBOrganizations are inactive
    • deleteOrganizations

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteOrganizations(@RequestParam String orgcode)
      Delete a diningcommons. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      orgcode - code of the commons
      Returns:
      a message indiciating the commons was deleted
    • updateOrganizations

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