Class RepositoryService

java.lang.Object
edu.ucsb.cs156.frontiers.services.RepositoryService

@Service public class RepositoryService extends Object
  • 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 question
      student - RosterStudent of the student the repository should be created for
      repoPrefix - Name of the project or assignment. Used to title the repository, in the format repoPrefix-githubLogin
      isPrivate - Whether the repository is private or not
      Throws:
      NoSuchAlgorithmException
      InvalidKeySpecException
      com.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 question
      staff - CourseStaff of the staff the repository should be created for
      repoPrefix - Name of the project or assignment. Used to title the repository, in the format repoPrefix-githubLogin
      isPrivate - Whether the repository is private or not
      Throws:
      NoSuchAlgorithmException
      InvalidKeySpecException
      com.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 to
      team - the team for which the repo is being created
      repoPrefix - prefix for the repository name (repoPrefix-teamName)
      isPrivate - whether the created repository should be private
      permissions - collaborator permissions to grant the user
      Throws:
      NoSuchAlgorithmException - if signing fails
      InvalidKeySpecException - if signing fails
      com.fasterxml.jackson.core.JsonProcessingException - if JSON serialization fails