1 | package edu.ucsb.cs156.courses.jobs; | |
2 | ||
3 | import edu.ucsb.cs156.courses.collections.ConvertedSectionCollection; | |
4 | import edu.ucsb.cs156.courses.repositories.UCSBSubjectRepository; | |
5 | import edu.ucsb.cs156.courses.services.UCSBCurriculumService; | |
6 | import java.util.ArrayList; | |
7 | import java.util.List; | |
8 | import lombok.extern.slf4j.Slf4j; | |
9 | import org.springframework.beans.factory.annotation.Autowired; | |
10 | import org.springframework.stereotype.Service; | |
11 | ||
12 | @Service | |
13 | @Slf4j | |
14 | public class UpdateCourseDataJobFactory { | |
15 | ||
16 | @Autowired private UCSBCurriculumService curriculumService; | |
17 | ||
18 | @Autowired private ConvertedSectionCollection convertedSectionCollection; | |
19 | ||
20 | @Autowired private UCSBSubjectRepository subjectRepository; | |
21 | ||
22 | public UpdateCourseDataJob createForSubjectAndQuarter(String subjectArea, String quarterYYYYQ) { | |
23 |
1
1. createForSubjectAndQuarter : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForSubjectAndQuarter → KILLED |
return new UpdateCourseDataJob( |
24 | quarterYYYYQ, | |
25 | quarterYYYYQ, | |
26 | List.of(subjectArea), | |
27 | curriculumService, | |
28 | convertedSectionCollection); | |
29 | } | |
30 | ||
31 | public UpdateCourseDataJob createForSubjectAndQuarterRange( | |
32 | String subjectArea, String start_quarterYYYYQ, String end_quarterYYYYQ) { | |
33 |
1
1. createForSubjectAndQuarterRange : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForSubjectAndQuarterRange → KILLED |
return new UpdateCourseDataJob( |
34 | start_quarterYYYYQ, | |
35 | end_quarterYYYYQ, | |
36 | List.of(subjectArea), | |
37 | curriculumService, | |
38 | convertedSectionCollection); | |
39 | } | |
40 | ||
41 | private List<String> getAllSubjectCodes() { | |
42 | var subjects = subjectRepository.findAll(); | |
43 | var subjectCodes = new ArrayList<String>(); | |
44 | for (var subject : subjects) { | |
45 | subjectCodes.add(subject.getSubjectCode()); | |
46 | } | |
47 |
1
1. getAllSubjectCodes : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::getAllSubjectCodes → KILLED |
return subjectCodes; |
48 | } | |
49 | ||
50 | public UpdateCourseDataJob createForQuarter(String quarterYYYYQ) { | |
51 |
1
1. createForQuarter : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForQuarter → KILLED |
return new UpdateCourseDataJob( |
52 | quarterYYYYQ, | |
53 | quarterYYYYQ, | |
54 | getAllSubjectCodes(), | |
55 | curriculumService, | |
56 | convertedSectionCollection); | |
57 | } | |
58 | ||
59 | public UpdateCourseDataJob createForQuarterRange( | |
60 | String start_quarterYYYYQ, String end_quarterYYYYQ) { | |
61 |
1
1. createForQuarterRange : replaced return value with null for edu/ucsb/cs156/courses/jobs/UpdateCourseDataJobFactory::createForQuarterRange → KILLED |
return new UpdateCourseDataJob( |
62 | start_quarterYYYYQ, | |
63 | end_quarterYYYYQ, | |
64 | getAllSubjectCodes(), | |
65 | curriculumService, | |
66 | convertedSectionCollection); | |
67 | } | |
68 | } | |
Mutations | ||
23 |
1.1 |
|
33 |
1.1 |
|
47 |
1.1 |
|
51 |
1.1 |
|
61 |
1.1 |