| 1 | package edu.ucsb.cs156.courses.jobs; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.courses.collections.ConvertedSectionCollection; | |
| 4 | import edu.ucsb.cs156.courses.collections.UpdateCollection; | |
| 5 | import edu.ucsb.cs156.courses.repositories.UCSBSubjectRepository; | |
| 6 | import edu.ucsb.cs156.courses.services.IsStaleService; | |
| 7 | import edu.ucsb.cs156.courses.services.UCSBCurriculumService; | |
| 8 | import java.util.ArrayList; | |
| 9 | import java.util.List; | |
| 10 | import lombok.extern.slf4j.Slf4j; | |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | import org.springframework.stereotype.Service; | |
| 13 | ||
| 14 | @Service | |
| 15 | @Slf4j | |
| 16 | public class UpdateCourseDataJobFactory { | |
| 17 | ||
| 18 | @Autowired private UCSBCurriculumService curriculumService; | |
| 19 | ||
| 20 | @Autowired private ConvertedSectionCollection convertedSectionCollection; | |
| 21 | ||
| 22 | @Autowired private UCSBSubjectRepository subjectRepository; | |
| 23 | ||
| 24 | @Autowired private UpdateCollection updateCollection; | |
| 25 | ||
| 26 | @Autowired private IsStaleService isStaleService; | |
| 27 | ||
| 28 | public UpdateCourseDataJob createForSubjectAndQuarter(String subjectArea, String quarterYYYYQ) { | |
| 29 |
1
1. createForSubjectAndQuarter : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForSubjectAndQuarter → KILLED |
return new UpdateCourseDataJob( |
| 30 | quarterYYYYQ, | |
| 31 | quarterYYYYQ, | |
| 32 | List.of(subjectArea), | |
| 33 | curriculumService, | |
| 34 | convertedSectionCollection, | |
| 35 | updateCollection, | |
| 36 | isStaleService, | |
| 37 | false); | |
| 38 | } | |
| 39 | ||
| 40 | public UpdateCourseDataJob createForSubjectAndQuarterAndIfStale( | |
| 41 | String subjectArea, String quarterYYYYQ, boolean ifStale) { | |
| 42 |
1
1. createForSubjectAndQuarterAndIfStale : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForSubjectAndQuarterAndIfStale → KILLED |
return new UpdateCourseDataJob( |
| 43 | quarterYYYYQ, | |
| 44 | quarterYYYYQ, | |
| 45 | List.of(subjectArea), | |
| 46 | curriculumService, | |
| 47 | convertedSectionCollection, | |
| 48 | updateCollection, | |
| 49 | isStaleService, | |
| 50 | ifStale); | |
| 51 | } | |
| 52 | ||
| 53 | public UpdateCourseDataJob createForSubjectAndQuarterRange( | |
| 54 | String subjectArea, String start_quarterYYYYQ, String end_quarterYYYYQ) { | |
| 55 |
1
1. createForSubjectAndQuarterRange : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForSubjectAndQuarterRange → KILLED |
return new UpdateCourseDataJob( |
| 56 | start_quarterYYYYQ, | |
| 57 | end_quarterYYYYQ, | |
| 58 | List.of(subjectArea), | |
| 59 | curriculumService, | |
| 60 | convertedSectionCollection, | |
| 61 | updateCollection, | |
| 62 | isStaleService, | |
| 63 | true); | |
| 64 | } | |
| 65 | ||
| 66 | private List<String> getAllSubjectCodes() { | |
| 67 | var subjects = subjectRepository.findAll(); | |
| 68 | var subjectCodes = new ArrayList<String>(); | |
| 69 | for (var subject : subjects) { | |
| 70 | subjectCodes.add(subject.getSubjectCode()); | |
| 71 | } | |
| 72 |
1
1. getAllSubjectCodes : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::getAllSubjectCodes → KILLED |
return subjectCodes; |
| 73 | } | |
| 74 | ||
| 75 | public UpdateCourseDataJob createForQuarter(String quarterYYYYQ) { | |
| 76 |
1
1. createForQuarter : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForQuarter → KILLED |
return new UpdateCourseDataJob( |
| 77 | quarterYYYYQ, | |
| 78 | quarterYYYYQ, | |
| 79 | getAllSubjectCodes(), | |
| 80 | curriculumService, | |
| 81 | convertedSectionCollection, | |
| 82 | updateCollection, | |
| 83 | isStaleService, | |
| 84 | true); | |
| 85 | } | |
| 86 | ||
| 87 | public UpdateCourseDataJob createForQuarterRange( | |
| 88 | String start_quarterYYYYQ, String end_quarterYYYYQ) { | |
| 89 |
1
1. createForQuarterRange : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForQuarterRange → KILLED |
return new UpdateCourseDataJob( |
| 90 | start_quarterYYYYQ, | |
| 91 | end_quarterYYYYQ, | |
| 92 | getAllSubjectCodes(), | |
| 93 | curriculumService, | |
| 94 | convertedSectionCollection, | |
| 95 | updateCollection, | |
| 96 | isStaleService, | |
| 97 | true); | |
| 98 | } | |
| 99 | } | |
Mutations | ||
| 29 |
1.1 |
|
| 42 |
1.1 |
|
| 55 |
1.1 |
|
| 72 |
1.1 |
|
| 76 |
1.1 |
|
| 89 |
1.1 |