| 1 | package edu.ucsb.cs156.frontiers.jobs; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.frontiers.entities.Course; | |
| 4 | import edu.ucsb.cs156.frontiers.entities.Team; | |
| 5 | import edu.ucsb.cs156.frontiers.enums.RepositoryPermissions; | |
| 6 | import edu.ucsb.cs156.frontiers.services.GithubTeamService; | |
| 7 | import edu.ucsb.cs156.frontiers.services.RepositoryService; | |
| 8 | import edu.ucsb.cs156.frontiers.services.jobs.JobContext; | |
| 9 | import edu.ucsb.cs156.frontiers.services.jobs.JobContextConsumer; | |
| 10 | import lombok.Builder; | |
| 11 | ||
| 12 | @Builder | |
| 13 | public class CreateTeamRepositoriesJob implements JobContextConsumer { | |
| 14 | Course course; | |
| 15 | RepositoryService repositoryService; | |
| 16 | GithubTeamService githubTeamService; | |
| 17 | String repositoryPrefix; | |
| 18 | Boolean isPrivate; | |
| 19 | RepositoryPermissions permissions; | |
| 20 | ||
| 21 | @Override | |
| 22 | public Course getCourse() { | |
| 23 |
1
1. getCourse : replaced return value with null for edu/ucsb/cs156/frontiers/jobs/CreateTeamRepositoriesJob::getCourse → KILLED |
return course; |
| 24 | } | |
| 25 | ||
| 26 | @Override | |
| 27 | public void accept(JobContext ctx) throws Exception { | |
| 28 | ctx.log("Creating team repositories..."); | |
| 29 | ||
| 30 | Integer orgId; | |
| 31 | try { | |
| 32 | orgId = githubTeamService.getOrgId(course.getOrgName(), course); | |
| 33 | } catch (Exception e) { | |
| 34 | throw new IllegalStateException( | |
| 35 | "Failed to get organization ID for org: " + course.getOrgName() + " - " + e.getMessage(), | |
| 36 | e); | |
| 37 | } | |
| 38 | ||
| 39 | for (Team team : course.getTeams()) { | |
| 40 |
1
1. accept : removed call to edu/ucsb/cs156/frontiers/services/RepositoryService::createTeamRepository → KILLED |
repositoryService.createTeamRepository( |
| 41 | course, team, repositoryPrefix, isPrivate, permissions, orgId); | |
| 42 | } | |
| 43 | ctx.log("Done"); | |
| 44 | } | |
| 45 | } | |
Mutations | ||
| 23 |
1.1 |
|
| 40 |
1.1 |