Class UCSBCurriculumService

java.lang.Object
edu.ucsb.cs156.courses.services.UCSBCurriculumService

@Service public class UCSBCurriculumService extends Object
Service object that wraps the UCSB Academic Curriculum API
  • Field Details

  • Constructor Details

    • UCSBCurriculumService

      public UCSBCurriculumService(org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder) throws Exception
      Throws:
      Exception
  • Method Details

    • getJSON

      public String getJSON(String subjectArea, String quarter, String courseLevel) throws Exception
      Throws:
      Exception
    • getConvertedSections

      public List<ConvertedSection> getConvertedSections(String subjectArea, String quarter, String courseLevel) throws Exception
      Throws:
      Exception
    • getPrimaries

      public List<Primary> getPrimaries(String subjectArea, String quarter, String courseLevel) throws Exception
      This method retrieves course information and reformats it so that each primary is a single object, that has a list of all of it's secondaries.

      As a reminder, the UCSB course registration systems (GOLD, Blue, Star, etc.) treat all courses as "sections", even what we typically call "lectures". In the database, some courses have both primary and secondary sections. Primary sections have section numbers ending in 00 (e.g. 100, 200, 300, up to 9900), while secondaries have numbers ending with 01, 02, 03, etc. and "belong" with a primary.

      What we typically refer to as "lectures" are primary sections ending in 00 (e.g. 100, 200, 300). What we typically refer to as discussion sections are secondaries and end with 01, 02, 03, etc.

      The UCSB API almost does this, but not quite. It returns a list of all sections, but does not group them into primaries and secondaries. This method relies on the getPrimaries method of the Page class to reformat the data so that each primary section is a single object, with a list of all of its secondaries.

      Parameters:
      subjectArea -
      quarter -
      courseLevel -
      Returns:
      a list of Primaries
      Throws:
      Exception
    • getSectionJSON

      public String getSectionJSON(String subjectArea, String quarter, String courseLevel) throws Exception
      Throws:
      Exception
    • getSubjectsJSON

      public String getSubjectsJSON() throws Exception
      Throws:
      Exception
    • getSection

      public String getSection(String enrollCode, String quarter) throws Exception
      This method retrieves exactly one section matching the enrollCode and quarter arguments, if such a section exists.
      Throws:
      Exception
    • getAllSections

      public String getAllSections(String enrollCode, String quarter) throws Exception
      This method retrieves all of the sections related to a certain enroll code. For example, if the enrollCode is for a discussion section, the lecture section and all related discussion sections will also be returned.
      Throws:
      Exception
    • getJSONbyQtrEnrollCd

      public String getJSONbyQtrEnrollCd(String quarter, String enrollCd) throws Exception
      Throws:
      Exception
    • getFinalsInfo

      public String getFinalsInfo(String quarter, String enrollCd) throws Exception
      Throws:
      Exception
    • getGeneralEducationInfo

      public String getGeneralEducationInfo() throws Exception
      Throws:
      Exception
    • getRequirementCodesByCollege

      public List<String> getRequirementCodesByCollege(String collegeCode) throws Exception
      Throws:
      Exception