| 1 | package edu.ucsb.cs156.courses.services; | |
| 2 | ||
| 3 | import com.fasterxml.jackson.core.type.TypeReference; | |
| 4 | import com.fasterxml.jackson.databind.ObjectMapper; | |
| 5 | import edu.ucsb.cs156.courses.documents.ConvertedSection; | |
| 6 | import edu.ucsb.cs156.courses.documents.CoursePage; | |
| 7 | import edu.ucsb.cs156.courses.documents.GERequirement; | |
| 8 | import edu.ucsb.cs156.courses.documents.Primary; | |
| 9 | import java.util.Arrays; | |
| 10 | import java.util.HashMap; | |
| 11 | import java.util.List; | |
| 12 | import java.util.Map; | |
| 13 | import java.util.stream.Collectors; | |
| 14 | import lombok.extern.slf4j.Slf4j; | |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | |
| 16 | import org.springframework.beans.factory.annotation.Value; | |
| 17 | import org.springframework.boot.web.client.RestTemplateBuilder; | |
| 18 | import org.springframework.http.HttpEntity; | |
| 19 | import org.springframework.http.HttpHeaders; | |
| 20 | import org.springframework.http.HttpMethod; | |
| 21 | import org.springframework.http.HttpStatus; | |
| 22 | import org.springframework.http.MediaType; | |
| 23 | import org.springframework.http.ResponseEntity; | |
| 24 | import org.springframework.stereotype.Service; | |
| 25 | import org.springframework.web.client.RestTemplate; | |
| 26 | ||
| 27 | /** Service object that wraps the UCSB Academic Curriculum API */ | |
| 28 | @Service | |
| 29 | @Slf4j | |
| 30 | public class UCSBCurriculumService { | |
| 31 | ||
| 32 | @Autowired private ObjectMapper objectMapper; | |
| 33 | ||
| 34 | @Value("${app.ucsb.api.consumer_key}") | |
| 35 | private String apiKey; | |
| 36 | ||
| 37 | private RestTemplate restTemplate = new RestTemplate(); | |
| 38 | ||
| 39 | public UCSBCurriculumService(RestTemplateBuilder restTemplateBuilder) throws Exception { | |
| 40 | restTemplate = restTemplateBuilder.build(); | |
| 41 | } | |
| 42 | ||
| 43 | public static final String CURRICULUM_ENDPOINT = | |
| 44 | "https://api.ucsb.edu/academics/curriculums/v1/classes/search"; | |
| 45 | ||
| 46 | public static final String SUBJECTS_ENDPOINT = | |
| 47 | "https://api.ucsb.edu/students/lookups/v1/subjects"; | |
| 48 | ||
| 49 | public static final String SECTION_ENDPOINT = | |
| 50 | "https://api.ucsb.edu/academics/curriculums/v1/classsection/{quarter}/{enrollcode}"; | |
| 51 | ||
| 52 | public static final String ALL_SECTIONS_ENDPOINT = | |
| 53 | "https://api.ucsb.edu/academics/curriculums/v3/classes/{quarter}/{enrollcode}"; | |
| 54 | ||
| 55 | public static final String FINALS_ENDPOINT = | |
| 56 | "https://api.ucsb.edu/academics/curriculums/v3/finals"; | |
| 57 | ||
| 58 | public static final String GE_ENDPOINT = "https://api.ucsb.edu/students/lookups/v1/requirements"; | |
| 59 | ||
| 60 | public String getJSON(String subjectArea, String quarter, String courseLevel) throws Exception { | |
| 61 | ||
| 62 | HttpHeaders headers = new HttpHeaders(); | |
| 63 |
1
1. getJSON : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED |
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); |
| 64 |
1
1. getJSON : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED |
headers.setContentType(MediaType.APPLICATION_JSON); |
| 65 |
1
1. getJSON : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-version", "1.0"); |
| 66 |
1
1. getJSON : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-key", this.apiKey); |
| 67 | ||
| 68 | HttpEntity<String> entity = new HttpEntity<>("body", headers); | |
| 69 | ||
| 70 | String params = | |
| 71 | String.format( | |
| 72 | "?quarter=%s&subjectCode=%s&objLevelCode=%s&pageNumber=%d&pageSize=%d&includeClassSections=%s", | |
| 73 | quarter, subjectArea, courseLevel, 1, 100, "true"); | |
| 74 | String url = CURRICULUM_ENDPOINT + params; | |
| 75 | ||
| 76 |
1
1. getJSON : negated conditional → KILLED |
if (courseLevel.equals("A")) { |
| 77 | params = | |
| 78 | String.format( | |
| 79 | "?quarter=%s&subjectCode=%s&pageNumber=%d&pageSize=%d&includeClassSections=%s", | |
| 80 | quarter, subjectArea, 1, 100, "true"); | |
| 81 | url = CURRICULUM_ENDPOINT + params; | |
| 82 | } | |
| 83 | ||
| 84 | log.info("url=" + url); | |
| 85 | ||
| 86 | String retVal = ""; | |
| 87 | MediaType contentType = null; | |
| 88 | HttpStatus statusCode = null; | |
| 89 | ||
| 90 | ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); | |
| 91 | contentType = re.getHeaders().getContentType(); | |
| 92 | statusCode = (HttpStatus) re.getStatusCode(); | |
| 93 | retVal = re.getBody(); | |
| 94 | ||
| 95 | log.trace("json: {}", retVal); | |
| 96 | log.info("contentType: {} statusCode: {}", contentType, statusCode); | |
| 97 |
1
1. getJSON : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSON → KILLED |
return retVal; |
| 98 | } | |
| 99 | ||
| 100 | public List<ConvertedSection> getConvertedSections( | |
| 101 | String subjectArea, String quarter, String courseLevel) throws Exception { | |
| 102 | String json = getJSON(subjectArea, quarter, courseLevel); | |
| 103 | CoursePage coursePage = objectMapper.readValue(json, CoursePage.class); | |
| 104 | List<ConvertedSection> result = coursePage.convertedSections(); | |
| 105 |
1
1. getConvertedSections : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getConvertedSections → KILLED |
return result; |
| 106 | } | |
| 107 | ||
| 108 | /** | |
| 109 | * This method retrieves course information and reformats it so that each primary is a single | |
| 110 | * object, that has a list of all of it's secondaries. | |
| 111 | * | |
| 112 | * <p>As a reminder, the UCSB course registration systems (GOLD, Blue, Star, etc.) treat all | |
| 113 | * courses as "sections", even what we typically call "lectures". In the database, some courses | |
| 114 | * have both primary and secondary sections. Primary sections have section numbers ending in 00 | |
| 115 | * (e.g. 100, 200, 300, up to 9900), while secondaries have numbers ending with 01, 02, 03, etc. | |
| 116 | * and "belong" with a primary. | |
| 117 | * | |
| 118 | * <p>What we typically refer to as "lectures" are primary sections ending in 00 (e.g. 100, 200, | |
| 119 | * 300). What we typically refer to as discussion sections are secondaries and end with 01, 02, | |
| 120 | * 03, etc. | |
| 121 | * | |
| 122 | * <p> | |
| 123 | * | |
| 124 | * <p>The UCSB API <i>almost</i> does this, but not quite. It returns a list of all sections, but | |
| 125 | * does not group them into primaries and secondaries. This method relies on the <code> | |
| 126 | * getPrimaries</code> method of the <code>Page</code> class to reformat the data so that each | |
| 127 | * primary section is a single object, with a list of all of its secondaries. | |
| 128 | * | |
| 129 | * @param subjectArea | |
| 130 | * @param quarter | |
| 131 | * @param courseLevel | |
| 132 | * @return a list of Primaries | |
| 133 | * @throws Exception | |
| 134 | */ | |
| 135 | public List<Primary> getPrimaries(String subjectArea, String quarter, String courseLevel) | |
| 136 | throws Exception { | |
| 137 | String json = getJSON(subjectArea, quarter, courseLevel); | |
| 138 | CoursePage coursePage = objectMapper.readValue(json, CoursePage.class); | |
| 139 | List<Primary> result = coursePage.getPrimaries(); | |
| 140 |
1
1. getPrimaries : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getPrimaries → KILLED |
return result; |
| 141 | } | |
| 142 | ||
| 143 | public String getJSONByGE(String quarter, String area) throws Exception { | |
| 144 | HttpHeaders headers = new HttpHeaders(); | |
| 145 |
1
1. getJSONByGE : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED |
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); |
| 146 |
1
1. getJSONByGE : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED |
headers.setContentType(MediaType.APPLICATION_JSON); |
| 147 |
1
1. getJSONByGE : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-version", "1.0"); |
| 148 |
1
1. getJSONByGE : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-key", this.apiKey); |
| 149 | ||
| 150 | HttpEntity<String> entity = new HttpEntity<>("body", headers); | |
| 151 | ||
| 152 | String params = | |
| 153 | String.format("?quarter=%s&areas=%s&pageNumber=%d&pageSize=%d", quarter, area, 1, 500); | |
| 154 | String url = CURRICULUM_ENDPOINT + params; | |
| 155 | ||
| 156 | log.info("url=" + url); | |
| 157 | ||
| 158 | String retVal = ""; | |
| 159 | MediaType contentType = null; | |
| 160 | HttpStatus statusCode = null; | |
| 161 | ||
| 162 | ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); | |
| 163 | contentType = re.getHeaders().getContentType(); | |
| 164 | statusCode = (HttpStatus) re.getStatusCode(); | |
| 165 | retVal = re.getBody(); | |
| 166 | ||
| 167 | log.trace("json: {}", retVal); | |
| 168 | log.info("contentType: {} statusCode: {}", contentType, statusCode); | |
| 169 |
1
1. getJSONByGE : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSONByGE → KILLED |
return retVal; |
| 170 | } | |
| 171 | ||
| 172 | public List<Primary> getPrimariesByGE(String quarter, String area) throws Exception { | |
| 173 | String json = getJSONByGE(quarter, area); | |
| 174 | CoursePage coursePage = objectMapper.readValue(json, CoursePage.class); | |
| 175 | List<Primary> result = coursePage.getPrimaries(); | |
| 176 |
1
1. getPrimariesByGE : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getPrimariesByGE → KILLED |
return result; |
| 177 | } | |
| 178 | ||
| 179 | public String getSectionJSON(String subjectArea, String quarter, String courseLevel) | |
| 180 | throws Exception { | |
| 181 | List<ConvertedSection> l = getConvertedSections(subjectArea, quarter, courseLevel); | |
| 182 | ||
| 183 | String arrayToJson = objectMapper.writeValueAsString(l); | |
| 184 | ||
| 185 |
1
1. getSectionJSON : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSectionJSON → KILLED |
return arrayToJson; |
| 186 | } | |
| 187 | ||
| 188 | public String getSubjectsJSON() throws Exception { | |
| 189 | ||
| 190 | HttpHeaders headers = new HttpHeaders(); | |
| 191 |
1
1. getSubjectsJSON : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED |
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); |
| 192 |
1
1. getSubjectsJSON : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED |
headers.setContentType(MediaType.APPLICATION_JSON); |
| 193 |
1
1. getSubjectsJSON : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-version", "1.0"); |
| 194 |
1
1. getSubjectsJSON : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-key", this.apiKey); |
| 195 | ||
| 196 | HttpEntity<String> entity = new HttpEntity<>("body", headers); | |
| 197 | ||
| 198 | log.info("url=" + SUBJECTS_ENDPOINT); | |
| 199 | ||
| 200 | String retVal = ""; | |
| 201 | MediaType contentType = null; | |
| 202 | HttpStatus statusCode = null; | |
| 203 | ||
| 204 | ResponseEntity<String> re = | |
| 205 | restTemplate.exchange(SUBJECTS_ENDPOINT, HttpMethod.GET, entity, String.class); | |
| 206 | contentType = re.getHeaders().getContentType(); | |
| 207 | statusCode = (HttpStatus) re.getStatusCode(); | |
| 208 | retVal = re.getBody(); | |
| 209 | ||
| 210 | log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode); | |
| 211 |
1
1. getSubjectsJSON : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSubjectsJSON → KILLED |
return retVal; |
| 212 | } | |
| 213 | ||
| 214 | /** | |
| 215 | * This method retrieves exactly one section matching the enrollCode and quarter arguments, if | |
| 216 | * such a section exists. | |
| 217 | */ | |
| 218 | public String getSection(String enrollCode, String quarter) throws Exception { | |
| 219 | ||
| 220 | HttpHeaders headers = new HttpHeaders(); | |
| 221 |
1
1. getSection : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED |
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); |
| 222 |
1
1. getSection : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED |
headers.setContentType(MediaType.APPLICATION_JSON); |
| 223 |
1
1. getSection : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-version", "1.0"); |
| 224 |
1
1. getSection : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-key", this.apiKey); |
| 225 | ||
| 226 | HttpEntity<String> entity = new HttpEntity<>("body", headers); | |
| 227 | ||
| 228 | String url = SECTION_ENDPOINT; | |
| 229 | ||
| 230 | log.info("url=" + url); | |
| 231 | ||
| 232 | Map<String, String> params = new HashMap<>(); | |
| 233 | params.put("quarter", quarter); | |
| 234 | params.put("enrollcode", enrollCode); | |
| 235 | ||
| 236 | String retVal = ""; | |
| 237 | MediaType contentType = null; | |
| 238 | HttpStatus statusCode = null; | |
| 239 | ||
| 240 | ResponseEntity<String> re = | |
| 241 | restTemplate.exchange(url, HttpMethod.GET, entity, String.class, params); | |
| 242 | contentType = re.getHeaders().getContentType(); | |
| 243 | statusCode = (HttpStatus) re.getStatusCode(); | |
| 244 | retVal = re.getBody(); | |
| 245 | ||
| 246 |
1
1. getSection : negated conditional → KILLED |
if (retVal.equals("null")) { |
| 247 | retVal = "{\"error\": \"Enroll code doesn't exist in that quarter.\"}"; | |
| 248 | } | |
| 249 | ||
| 250 | log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode); | |
| 251 |
1
1. getSection : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSection → KILLED |
return retVal; |
| 252 | } | |
| 253 | ||
| 254 | /** | |
| 255 | * This method retrieves all of the sections related to a certain enroll code. For example, if the | |
| 256 | * enrollCode is for a discussion section, the lecture section and all related discussion sections | |
| 257 | * will also be returned. | |
| 258 | */ | |
| 259 | public String getAllSections(String enrollCode, String quarter) throws Exception { | |
| 260 | ||
| 261 | HttpHeaders headers = new HttpHeaders(); | |
| 262 |
1
1. getAllSections : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED |
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); |
| 263 |
1
1. getAllSections : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED |
headers.setContentType(MediaType.APPLICATION_JSON); |
| 264 |
1
1. getAllSections : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-version", "3.0"); |
| 265 |
1
1. getAllSections : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-key", this.apiKey); |
| 266 | ||
| 267 | HttpEntity<String> entity = new HttpEntity<>("body", headers); | |
| 268 | ||
| 269 | String url = ALL_SECTIONS_ENDPOINT; | |
| 270 | ||
| 271 | log.info("url=" + url); | |
| 272 | ||
| 273 | Map<String, String> params = new HashMap<>(); | |
| 274 | params.put("quarter", quarter); | |
| 275 | params.put("enrollcode", enrollCode); | |
| 276 | ||
| 277 | String retVal = ""; | |
| 278 | MediaType contentType = null; | |
| 279 | HttpStatus statusCode = null; | |
| 280 | ||
| 281 | ResponseEntity<String> re = | |
| 282 | restTemplate.exchange(url, HttpMethod.GET, entity, String.class, params); | |
| 283 | contentType = re.getHeaders().getContentType(); | |
| 284 | statusCode = (HttpStatus) re.getStatusCode(); | |
| 285 | retVal = re.getBody(); | |
| 286 | ||
| 287 |
1
1. getAllSections : negated conditional → KILLED |
if (retVal.equals("null")) { |
| 288 | retVal = "{\"error\": \"Enroll code doesn't exist in that quarter.\"}"; | |
| 289 | } | |
| 290 | ||
| 291 | log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode); | |
| 292 |
1
1. getAllSections : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getAllSections → KILLED |
return retVal; |
| 293 | } | |
| 294 | ||
| 295 | public String getJSONbyQtrEnrollCd(String quarter, String enrollCd) throws Exception { | |
| 296 | ||
| 297 | HttpHeaders headers = new HttpHeaders(); | |
| 298 |
1
1. getJSONbyQtrEnrollCd : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED |
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); |
| 299 |
1
1. getJSONbyQtrEnrollCd : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED |
headers.setContentType(MediaType.APPLICATION_JSON); |
| 300 |
1
1. getJSONbyQtrEnrollCd : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-version", "1.0"); |
| 301 |
1
1. getJSONbyQtrEnrollCd : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-key", this.apiKey); |
| 302 | ||
| 303 | HttpEntity<String> entity = new HttpEntity<>("body", headers); | |
| 304 | ||
| 305 | String url = | |
| 306 | "https://api.ucsb.edu/academics/curriculums/v3/classsection/" + quarter + "/" + enrollCd; | |
| 307 | ||
| 308 | log.info("url=" + url); | |
| 309 | ||
| 310 | String retVal = ""; | |
| 311 | MediaType contentType = null; | |
| 312 | HttpStatus statusCode = null; | |
| 313 | ||
| 314 | ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); | |
| 315 | contentType = re.getHeaders().getContentType(); | |
| 316 | statusCode = (HttpStatus) re.getStatusCode(); | |
| 317 | retVal = re.getBody(); | |
| 318 | ||
| 319 | log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode); | |
| 320 |
1
1. getJSONbyQtrEnrollCd : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSONbyQtrEnrollCd → KILLED |
return retVal; |
| 321 | } | |
| 322 | ||
| 323 | public String getFinalsInfo(String quarter, String enrollCd) throws Exception { | |
| 324 | HttpHeaders headers = new HttpHeaders(); | |
| 325 |
1
1. getFinalsInfo : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED |
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); |
| 326 |
1
1. getFinalsInfo : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-version", "3.0"); |
| 327 |
1
1. getFinalsInfo : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-key", this.apiKey); |
| 328 | ||
| 329 | HttpEntity<String> entity = new HttpEntity<>("body", headers); | |
| 330 | ||
| 331 | String params = String.format("?quarter=%s&enrollCode=%s", quarter, enrollCd); | |
| 332 | String url = FINALS_ENDPOINT + params; | |
| 333 | ||
| 334 | log.info("url=" + url); | |
| 335 | ||
| 336 | String retVal; | |
| 337 | MediaType contentType; | |
| 338 | HttpStatus statusCode; | |
| 339 | ||
| 340 | ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); | |
| 341 | contentType = re.getHeaders().getContentType(); | |
| 342 | statusCode = (HttpStatus) re.getStatusCode(); | |
| 343 | retVal = re.getBody(); | |
| 344 | ||
| 345 | log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode); | |
| 346 |
1
1. getFinalsInfo : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getFinalsInfo → KILLED |
return retVal; |
| 347 | } | |
| 348 | ||
| 349 | public String getGeneralEducationInfo() throws Exception { | |
| 350 | HttpHeaders headers = new HttpHeaders(); | |
| 351 |
1
1. getGeneralEducationInfo : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED |
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); |
| 352 |
1
1. getGeneralEducationInfo : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED |
headers.setContentType(MediaType.APPLICATION_JSON); |
| 353 |
1
1. getGeneralEducationInfo : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-version", "1.0"); |
| 354 |
1
1. getGeneralEducationInfo : removed call to org/springframework/http/HttpHeaders::set → KILLED |
headers.set("ucsb-api-key", this.apiKey); |
| 355 | ||
| 356 | HttpEntity<String> entity = new HttpEntity<>("body", headers); | |
| 357 | ||
| 358 | log.info("Fetching GE areas from {}", GE_ENDPOINT); | |
| 359 | ResponseEntity<String> response = | |
| 360 | restTemplate.exchange(GE_ENDPOINT, HttpMethod.GET, entity, String.class); | |
| 361 | ||
| 362 | log.debug("GE areas JSON: {}", response.getBody()); | |
| 363 |
1
1. getGeneralEducationInfo : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getGeneralEducationInfo → KILLED |
return response.getBody(); |
| 364 | } | |
| 365 | ||
| 366 | public List<String> getRequirementCodesByCollege(String collegeCode) throws Exception { | |
| 367 | String json = getGeneralEducationInfo(); | |
| 368 | ||
| 369 | List<GERequirement> allAreas = | |
| 370 | objectMapper.readValue(json, new TypeReference<List<GERequirement>>() {}); | |
| 371 | ||
| 372 |
1
1. getRequirementCodesByCollege : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getRequirementCodesByCollege → KILLED |
return allAreas.stream() |
| 373 |
2
1. lambda$getRequirementCodesByCollege$0 : replaced boolean return with false for edu/ucsb/cs156/courses/services/UCSBCurriculumService::lambda$getRequirementCodesByCollege$0 → KILLED 2. lambda$getRequirementCodesByCollege$0 : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBCurriculumService::lambda$getRequirementCodesByCollege$0 → KILLED |
.filter(area -> area.getCollegeCode().equalsIgnoreCase(collegeCode)) |
| 374 | .map(GERequirement::getRequirementCode) | |
| 375 | .distinct() | |
| 376 | .collect(Collectors.toList()); | |
| 377 | } | |
| 378 | } | |
Mutations | ||
| 63 |
1.1 |
|
| 64 |
1.1 |
|
| 65 |
1.1 |
|
| 66 |
1.1 |
|
| 76 |
1.1 |
|
| 97 |
1.1 |
|
| 105 |
1.1 |
|
| 140 |
1.1 |
|
| 145 |
1.1 |
|
| 146 |
1.1 |
|
| 147 |
1.1 |
|
| 148 |
1.1 |
|
| 169 |
1.1 |
|
| 176 |
1.1 |
|
| 185 |
1.1 |
|
| 191 |
1.1 |
|
| 192 |
1.1 |
|
| 193 |
1.1 |
|
| 194 |
1.1 |
|
| 211 |
1.1 |
|
| 221 |
1.1 |
|
| 222 |
1.1 |
|
| 223 |
1.1 |
|
| 224 |
1.1 |
|
| 246 |
1.1 |
|
| 251 |
1.1 |
|
| 262 |
1.1 |
|
| 263 |
1.1 |
|
| 264 |
1.1 |
|
| 265 |
1.1 |
|
| 287 |
1.1 |
|
| 292 |
1.1 |
|
| 298 |
1.1 |
|
| 299 |
1.1 |
|
| 300 |
1.1 |
|
| 301 |
1.1 |
|
| 320 |
1.1 |
|
| 325 |
1.1 |
|
| 326 |
1.1 |
|
| 327 |
1.1 |
|
| 346 |
1.1 |
|
| 351 |
1.1 |
|
| 352 |
1.1 |
|
| 353 |
1.1 |
|
| 354 |
1.1 |
|
| 363 |
1.1 |
|
| 372 |
1.1 |
|
| 373 |
1.1 2.2 |