@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()); } });
public void update() throws IOException { ArrayList<GitlabProjectMember> memberList = new ArrayList<GitlabProjectMember>(); milestones = api().getMilestones(project); memberList.addAll(api().getProjectMembers(project)); // This might fail sometimes, because the namespace is not an actual namespace. // If the "namespace" is a user namespace, it will fail try { memberList.addAll(api().getNamespaceMembers(project.getNamespace())); } catch(Exception e) { } catch(Error e) { } members = Collections.unmodifiableList(memberList); }
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(); }
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; }
@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()); }
.appendIf("printing_merge_request_link_enabled", project.isPrintingMergeRequestLinkEnabled()); GitlabNamespace namespace = project.getNamespace(); if (namespace != null) { query.appendIf("namespace_id", namespace.getId());
.appendIf("printing_merge_request_link_enabled", project.isPrintingMergeRequestLinkEnabled()); GitlabNamespace namespace = project.getNamespace(); if (namespace != null) { query.appendIf("namespace_id", namespace.getId());
.appendIf("printing_merge_request_link_enabled", project.isPrintingMergeRequestLinkEnabled()); GitlabNamespace namespace = project.getNamespace(); if (namespace != null) { query.appendIf("namespace_id", namespace.getId());