/** * This will fail, if the given namespace is a user and not a group * * @param namespace The namespace * @return A list of Gitlab Project members * @throws IOException on gitlab api call error */ public List<GitlabProjectMember> getNamespaceMembers(GitlabNamespace namespace) throws IOException { return getNamespaceMembers(namespace.getId()); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GitlabProject that = (GitlabProject) o; if (id != null || that.id != null) { return id != null && id.equals(that.id); } else { if (name != null ? !name.equals(that.name) : that.name != null) return false; return namespace != null ? namespace.equals(that.namespace) : that.namespace == null; } }
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (namespace != null ? namespace.hashCode() : 0); return result; } }
private static String groupAvatarUrl(GitlabProject project, String connectionName) throws GitLabAPIException { GitlabNamespace namespace = project.getNamespace(); if (namespace.getOwnerId() != null) { return null; } GitLabGroup group = gitLabAPI(connectionName).getGroup(namespace.getId()); return group.getAvatarUrl(); }
@Override public int compare(GitlabProject o1, GitlabProject o2) { GitlabNamespace namespace1 = o1.getNamespace(); String n1 = namespace1 != null ? namespace1.getName().toLowerCase() : "Default"; GitlabNamespace namespace2 = o2.getNamespace(); String n2 = namespace2 != null ? namespace2.getName().toLowerCase() : "Default"; int compareNamespace = n1.compareTo(n2); return compareNamespace != 0 ? compareNamespace : o1.getName().toLowerCase().compareTo(o2.getName().toLowerCase()); } });
@Test public void testCreateDeleteFork() throws Exception { String projectName = randVal("Fork-me"); String password = randVal("$%password"); GitlabUser gitUser = api.createUser(randVal("testEmail@gitlabapitest.com"), password, randVal("userName"), randVal("fullName"), randVal("skypeId"), randVal("linkedin"), randVal("twitter"), "http://" + randVal("url.com"), 10, randVal("externuid"), randVal("externprovidername"), randVal("bio"), false, false, false, false); String namespace = api.getNamespaces().get(0).getPath(); GitlabProject project = api.createUserProject(gitUser.getId(), projectName); GitlabProject fork = api.createFork(namespace, project); assertNotNull(fork); assertEquals(project.getId(), fork.getForkedFrom().getId()); assertEquals(project.getNamespace(), namespace); api.deleteProject(project.getId()); api.deleteProject(fork.getId()); api.deleteUser(gitUser.getId()); }
public Collection<ProjectDto> loadProjects(GitlabServer server) throws Throwable { ApiFacade apiFacade = api(server); Collection<ProjectDto> projects = getProjects(); if(projects == null) { projects = new ArrayList<>(); } for (GitlabProject gitlabProject : apiFacade.getProjects()) { ProjectDto projectDto = new ProjectDto(); projectDto.setName(gitlabProject.getName()); projectDto.setNamespace(gitlabProject.getNamespace().getName()); projectDto.setHttpUrl(gitlabProject.getHttpUrl()); projectDto.setSshUrl(gitlabProject.getSshUrl()); projects.add(projectDto); } this.setProjects(projects); return projects; }
/** * This will fail, if the given namespace is a user and not a group * * @param namespace The namespace * @return A list of Gitlab Project members * @throws IOException on gitlab api call error */ public List<GitlabProjectMember> getNamespaceMembers(GitlabNamespace namespace) throws IOException { return getNamespaceMembers(namespace.getId()); }
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (namespace != null ? namespace.hashCode() : 0); return result; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GitlabProject that = (GitlabProject) o; if (id != null || that.id != null) { return id != null && id.equals(that.id); } else { if (name != null ? !name.equals(that.name) : that.name != null) return false; return namespace != null ? namespace.equals(that.namespace) : that.namespace == null; } }
/** * This will fail, if the given namespace is a user and not a group * * @param namespace The namespace * @return A list of Gitlab Project members * @throws IOException on gitlab api call error */ public List<GitlabProjectMember> getNamespaceMembers(GitlabNamespace namespace) throws IOException { return getNamespaceMembers(namespace.getId()); }
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (namespace != null ? namespace.hashCode() : 0); return result; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GitlabProject that = (GitlabProject) o; if (id != null || that.id != null) { return id != null && id.equals(that.id); } else { if (name != null ? !name.equals(that.name) : that.name != null) return false; return namespace != null ? namespace.equals(that.namespace) : that.namespace == null; } }
query.appendIf("namespace_id", namespace.getId());
query.appendIf("namespace_id", namespace.getId());
query.appendIf("namespace_id", namespace.getId());