Class RosterStudentsCSVController

java.lang.Object
edu.ucsb.cs156.frontiers.controllers.ApiController
edu.ucsb.cs156.frontiers.controllers.RosterStudentsCSVController

@RequestMapping("/api/rosterstudents") @RestController public class RosterStudentsCSVController extends ApiController
  • Field Details

  • Constructor Details

    • RosterStudentsCSVController

      public RosterStudentsCSVController()
  • Method Details

    • getRosterSourceType

      public static RosterStudentsCSVController.RosterSourceType getRosterSourceType(String[] headers)
    • uploadRosterStudentsCSV

      @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PostMapping(value="/upload/csv", consumes="multipart/form-data") public org.springframework.http.ResponseEntity<LoadResult> uploadRosterStudentsCSV(@RequestParam Long courseId, @RequestParam("file") org.springframework.web.multipart.MultipartFile file) throws com.fasterxml.jackson.core.JsonProcessingException, IOException, com.opencsv.exceptions.CsvException
      Upload Roster students for Course in any supported format. It is important to keep the code in this method consistent with the code for adding a single roster student
      Parameters:
      courseId -
      file -
      Returns:
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
      IOException
      com.opencsv.exceptions.CsvException
    • fromCSVRow

      public static RosterStudent fromCSVRow(String[] row, RosterStudentsCSVController.RosterSourceType sourceType)
    • checkRowLength

      public static void checkRowLength(String[] row, int expectedLength, RosterStudentsCSVController.RosterSourceType sourceType)
    • fromUCSBEgradesCSVRow

      public static RosterStudent fromUCSBEgradesCSVRow(String[] row)
    • fromChicoCanvasCSVRow

      public static RosterStudent fromChicoCanvasCSVRow(String[] row)
    • fromOregonStateCSVRow

      public static RosterStudent fromOregonStateCSVRow(String[] row)
    • getFirstName

      public static String getFirstName(String fullName)
      Get everything except up to and not including the last space in the full name. If the string contains no spaces, return an empty string.
      Parameters:
      fullName -
      Returns:
    • getLastName

      public static String getLastName(String fullName)
      Get everything after the last space in the full name. If the string contains no spaces, return the entire input string as the result.
      Parameters:
      fullName -
      Returns:
      best estimate of last name