private List<String> toStringBranches(Collection<GitlabBranch> branches) { List<String> list = new ArrayList<>(branches.size()); for (GitlabBranch branch : branches) { list.add(branch.getName()); } return list; }
private List<String> toStringTags(Collection<GitlabTag> tags) { List<String> list = new ArrayList<>(tags.size()); for (GitlabTag tag : tags) { list.add(tag.getName()); } return list; } }
@Override public GitCommit commit(String refName) throws GitException { checkProject(); try { List<GitlabCommit> lastCommits = connect.getLastCommits(project.getId(), refName); GitlabCommit gitlabCommit = lastCommits.get(0); String commitId = gitlabCommit.getId(); String commitMessage = gitlabCommit.getMessage(); String commitAuthorEmail = gitlabCommit.getAuthorEmail(); return new GitCommit(commitId, commitMessage, commitAuthorEmail); } catch (IOException e) { throw new GitException(e.getMessage()); } }
@Override public List<GitProject> projects() throws GitException { try { List<GitlabProject> projects = connect.getMembershipProjects(); List<GitProject> results = new ArrayList<>(projects.size()); for (GitlabProject project : projects) { Integer id = project.getId(); String name = project.getName(); String fullName = project.getNameWithNamespace(); results.add(new GitProject(id.toString(), name, fullName)); } return results; } catch (IOException e) { throw new GitException(e.getMessage()); } }
/** * Add a project member. * * @param project the GitlabProject * @param user the GitlabUser * @param accessLevel the GitlabAccessLevel * @return the GitlabProjectMember * @throws IOException on gitlab api call error */ public GitlabProjectMember addProjectMember(GitlabProject project, GitlabUser user, GitlabAccessLevel accessLevel) throws IOException { return addProjectMember(project.getId(), user.getId(), accessLevel); }
/** * Delete a shared project link within a group. * * @param group The group. * @param project The project. * @throws IOException on gitlab api call error */ public void deleteSharedProjectGroupLink(GitlabGroup group, GitlabProject project) throws IOException { deleteSharedProjectGroupLink(group.getId(), project.getId()); }
public GitlabAccessLevel getLdapAccess() { if (ldapAccess == null) { return null; } return GitlabAccessLevel.fromAccessValue(ldapAccess); }
@Override public String fetch(String branch, String filePath, ProgressMonitor monitor) throws GitException { checkProject(); try { GitlabRepositoryFile file = connect.getRepositoryFile(project, filePath, branch); String base64Content = file.getContent(); byte[] contentBytes = Base64.getDecoder().decode(base64Content); return new String(contentBytes, "UTF-8"); } catch (IOException e) { return null; } }
/** * Add a group member. * * @param group the GitlabGroup * @param user the GitlabUser * @param accessLevel the GitlabAccessLevel * @return the GitlabGroupMember * @throws IOException on gitlab api call error */ public GitlabGroupMember addGroupMember(GitlabGroup group, GitlabUser user, GitlabAccessLevel accessLevel) throws IOException { return addGroupMember(group.getId(), user.getId(), accessLevel); }
public GitlabAccessLevel getLdapAccess() { if (ldapAccess == null) { return null; } return GitlabAccessLevel.fromAccessValue(ldapAccess); }
/** * Add a group member. * * @param group the GitlabGroup * @param user the GitlabUser * @param accessLevel the GitlabAccessLevel * @return the GitlabGroupMember * @throws IOException on gitlab api call error */ public GitlabGroupMember addGroupMember(GitlabGroup group, GitlabUser user, GitlabAccessLevel accessLevel) throws IOException { return addGroupMember(group.getId(), user.getId(), accessLevel); }
public GitlabAccessLevel getLdapAccess() { if (ldapAccess == null) { return null; } return GitlabAccessLevel.fromAccessValue(ldapAccess); }