| 1 | package edu.ucsb.cs156.frontiers.jobs; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.frontiers.entities.Course; | |
| 4 | import edu.ucsb.cs156.frontiers.entities.CourseStaff; | |
| 5 | import edu.ucsb.cs156.frontiers.entities.RosterStudent; | |
| 6 | import edu.ucsb.cs156.frontiers.enums.OrgStatus; | |
| 7 | import edu.ucsb.cs156.frontiers.enums.RepositoryCreationOption; | |
| 8 | import edu.ucsb.cs156.frontiers.enums.RepositoryPermissions; | |
| 9 | import edu.ucsb.cs156.frontiers.services.RepositoryService; | |
| 10 | import edu.ucsb.cs156.frontiers.services.jobs.JobContext; | |
| 11 | import edu.ucsb.cs156.frontiers.services.jobs.JobContextConsumer; | |
| 12 | import lombok.Builder; | |
| 13 | ||
| 14 | @Builder | |
| 15 | public class CreateStudentOrStaffRepositoriesJob implements JobContextConsumer { | |
| 16 | Course course; | |
| 17 | RepositoryService repositoryService; | |
| 18 | String repositoryPrefix; | |
| 19 | Boolean isPrivate; | |
| 20 | RepositoryPermissions permissions; | |
| 21 | ||
| 22 | @Builder.Default RepositoryCreationOption creationOption = RepositoryCreationOption.STUDENTS_ONLY; | |
| 23 | ||
| 24 | @Override | |
| 25 | public Course getCourse() { | |
| 26 |
1
1. getCourse : replaced return value with null for edu/ucsb/cs156/frontiers/jobs/CreateStudentOrStaffRepositoriesJob::getCourse → KILLED |
return course; |
| 27 | } | |
| 28 | ||
| 29 | @Override | |
| 30 | public void accept(JobContext ctx) throws Exception { | |
| 31 | ctx.log("repositoryPrefix=" + repositoryPrefix); | |
| 32 | ctx.log("isPrivate=" + isPrivate); | |
| 33 | ctx.log("permissions=" + permissions); | |
| 34 | ctx.log("creationOption=" + creationOption); | |
| 35 | ||
| 36 |
2
1. accept : negated conditional → KILLED 2. accept : negated conditional → KILLED |
if (creationOption == RepositoryCreationOption.STUDENTS_ONLY |
| 37 | || creationOption == RepositoryCreationOption.STUDENTS_AND_STAFF) { | |
| 38 | for (RosterStudent student : course.getRosterStudents()) { | |
| 39 |
1
1. accept : negated conditional → KILLED |
if (student.getGithubLogin() != null |
| 40 |
1
1. accept : negated conditional → KILLED |
&& (student.getOrgStatus() == OrgStatus.MEMBER |
| 41 |
1
1. accept : negated conditional → KILLED |
|| student.getOrgStatus() == OrgStatus.OWNER)) { |
| 42 |
1
1. accept : removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createStudentRepository → KILLED |
repositoryService.createStudentRepository( |
| 43 | course, student, repositoryPrefix, isPrivate, permissions); | |
| 44 | } | |
| 45 | } | |
| 46 | } | |
| 47 | ||
| 48 |
2
1. accept : negated conditional → KILLED 2. accept : negated conditional → KILLED |
if (creationOption == RepositoryCreationOption.STAFF_ONLY |
| 49 | || creationOption == RepositoryCreationOption.STUDENTS_AND_STAFF) { | |
| 50 | for (CourseStaff staff : course.getCourseStaff()) { | |
| 51 |
1
1. accept : negated conditional → KILLED |
if (staff.getGithubLogin() != null |
| 52 |
1
1. accept : negated conditional → KILLED |
&& (staff.getOrgStatus() == OrgStatus.MEMBER |
| 53 |
1
1. accept : negated conditional → KILLED |
|| staff.getOrgStatus() == OrgStatus.OWNER)) { |
| 54 |
1
1. accept : removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createStaffRepository → KILLED |
repositoryService.createStaffRepository( |
| 55 | course, staff, repositoryPrefix, isPrivate, permissions); | |
| 56 | } | |
| 57 | } | |
| 58 | } | |
| 59 | ||
| 60 | ctx.log("Done"); | |
| 61 | } | |
| 62 | } | |
Mutations | ||
| 26 |
1.1 |
|
| 36 |
1.1 2.2 |
|
| 39 |
1.1 |
|
| 40 |
1.1 |
|
| 41 |
1.1 |
|
| 42 |
1.1 |
|
| 48 |
1.1 2.2 |
|
| 51 |
1.1 |
|
| 52 |
1.1 |
|
| 53 |
1.1 |
|
| 54 |
1.1 |