add a new getJobs() method to get all jobs

This commit is contained in:
Vincent Behar 2011-07-04 15:00:35 +02:00
parent 77274e1d8a
commit fe5f42fa14

View file

@ -1,6 +1,7 @@
package org.rundeck.api;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
@ -102,6 +103,21 @@ public class RundeckClient implements Serializable {
* Jobs
*/
/**
* List all jobs (for all projects)
*
* @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null
* @throws RundeckApiException in case of error when calling the API
* @throws RundeckApiLoginException if the login failed
*/
public List<RundeckJob> getJobs() throws RundeckApiException, RundeckApiLoginException {
List<RundeckJob> jobs = new ArrayList<RundeckJob>();
for (RundeckProject project : getProjects()) {
jobs.addAll(getJobs(project.getName()));
}
return jobs;
}
/**
* List all jobs that belongs to the given project
*