Class RepositoryService
java.lang.Object
edu.ucsb.cs156.frontiers.services.RepositoryService
-
Constructor Summary
ConstructorsConstructorDescriptionRepositoryService(JwtService jwtService, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder, com.fasterxml.jackson.databind.ObjectMapper mapper) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateStaffRepository(Course course, CourseStaff staff, String repoPrefix, Boolean isPrivate, RepositoryPermissions permissions) Creates a single staff repository if it doesn't already exist, and provisions access to the repository by that staff membervoidcreateStudentRepository(Course course, RosterStudent student, String repoPrefix, Boolean isPrivate, RepositoryPermissions permissions) Creates a single student repository if it doesn't already exist, and provisions access to the repository by that studentvoidcreateTeamRepository(Course course, Team team, String repoPrefix, Boolean isPrivate, RepositoryPermissions permissions) Creates a GitHub repository for a team (student or staff), given only their team name.
-
Constructor Details
-
RepositoryService
public RepositoryService(JwtService jwtService, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder, com.fasterxml.jackson.databind.ObjectMapper mapper)
-
-
Method Details
-
createStudentRepository
public void createStudentRepository(Course course, RosterStudent student, String repoPrefix, Boolean isPrivate, RepositoryPermissions permissions) throws NoSuchAlgorithmException, InvalidKeySpecException, com.fasterxml.jackson.core.JsonProcessingException Creates a single student repository if it doesn't already exist, and provisions access to the repository by that student- Parameters:
course- The Course in questionstudent- RosterStudent of the student the repository should be created forrepoPrefix- Name of the project or assignment. Used to title the repository, in the format repoPrefix-githubLoginisPrivate- Whether the repository is private or not- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
createStaffRepository
public void createStaffRepository(Course course, CourseStaff staff, String repoPrefix, Boolean isPrivate, RepositoryPermissions permissions) throws NoSuchAlgorithmException, InvalidKeySpecException, com.fasterxml.jackson.core.JsonProcessingException Creates a single staff repository if it doesn't already exist, and provisions access to the repository by that staff member- Parameters:
course- The Course in questionstaff- CourseStaff of the staff the repository should be created forrepoPrefix- Name of the project or assignment. Used to title the repository, in the format repoPrefix-githubLoginisPrivate- Whether the repository is private or not- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
createTeamRepository
public void createTeamRepository(Course course, Team team, String repoPrefix, Boolean isPrivate, RepositoryPermissions permissions) throws NoSuchAlgorithmException, InvalidKeySpecException, com.fasterxml.jackson.core.JsonProcessingException Creates a GitHub repository for a team (student or staff), given only their team name.- Checks whether the repository already exists.
- If not, creates a new repository under the course's organization.
- Adds all team members as collaborators with the given permission level.
- Parameters:
course- the course whose organization the repo belongs toteam- the team for which the repo is being createdrepoPrefix- prefix for the repository name (repoPrefix-teamName)isPrivate- whether the created repository should be privatepermissions- collaborator permissions to grant the user- Throws:
NoSuchAlgorithmException- if signing failsInvalidKeySpecException- if signing failscom.fasterxml.jackson.core.JsonProcessingException- if JSON serialization fails
-