@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()); } }
/** * Returns the list of build triggers for a project. * * @param project the project * @return list of build triggers * @throws IllegalStateException if jobs are not enabled for the project */ public List<GitlabTrigger> getPipelineTriggers(GitlabProject project) { if (!project.isJobsEnabled()) { // if the project has not allowed jobs, you will only get a 403 forbidden message which is // not helpful. throw new IllegalStateException("Jobs are not enabled for " + project.getNameWithNamespace()); } else { return retrieve().getAll(GitlabProject.URL + "/" + project.getId() + GitlabTrigger.URL + PARAM_MAX_ITEMS_PER_PAGE, GitlabTrigger[].class); } }
/** * Returns the list of build triggers for a project. * * @param project the project * @return list of build triggers * @throws IllegalStateException if jobs are not enabled for the project */ public List<GitlabTrigger> getPipelineTriggers(GitlabProject project) { if (!project.isJobsEnabled()) { // if the project has not allowed jobs, you will only get a 403 forbidden message which is // not helpful. throw new IllegalStateException("Jobs are not enabled for " + project.getNameWithNamespace()); } else { return retrieve().getAll(GitlabProject.URL + "/" + project.getId() + GitlabTrigger.URL + PARAM_MAX_ITEMS_PER_PAGE, GitlabTrigger[].class); } }
/** * Returns the list of build triggers for a project. * * @param project the project * @return list of build triggers * @throws IllegalStateException if jobs are not enabled for the project */ public List<GitlabTrigger> getPipelineTriggers(GitlabProject project) { if (!project.isJobsEnabled()) { // if the project has not allowed jobs, you will only get a 403 forbidden message which is // not helpful. throw new IllegalStateException("Jobs are not enabled for " + project.getNameWithNamespace()); } else { return retrieve().getAll(GitlabProject.URL + "/" + project.getId() + GitlabTrigger.URL + PARAM_MAX_ITEMS_PER_PAGE, GitlabTrigger[].class); } }