config.xml which should be used to create
- * the job.
+ * @param jobXml the config.xml which should be used to create
+ * the job.
* @throws IOException in case of an error.
*/
public void createJob(String jobName, String jobXml) throws IOException {
@@ -347,12 +348,12 @@ public void createJob(String jobName, String jobXml) throws IOException {
/**
* Create a job on the server using the provided xml
- *
- * @param jobName name of the job to be created.
- * @param jobXml the config.xml which should be used to create
- * the job.
+ *
+ * @param jobName name of the job to be created.
+ * @param jobXml the config.xml which should be used to create
+ * the job.
* @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @throws IOException in case of an error.
*/
public void createJob(String jobName, String jobXml, Boolean crumbFlag) throws IOException {
@@ -363,10 +364,10 @@ public void createJob(String jobName, String jobXml, Boolean crumbFlag) throws I
* Create a job on the server using the provided xml and in the provided
* folder
*
- * @param folder {@link FolderJob}
+ * @param folder {@link FolderJob}
* @param jobName name of the job to be created.
- * @param jobXml the config.xml which should be used to create
- * the job.
+ * @param jobXml the config.xml which should be used to create
+ * the job.
* @throws IOException in case of an error.
*/
public void createJob(FolderJob folder, String jobName, String jobXml) throws IOException {
@@ -377,12 +378,12 @@ public void createJob(FolderJob folder, String jobName, String jobXml) throws IO
* Create a job on the server using the provided xml and in the provided
* folder
*
- * @param folder {@link FolderJob}
- * @param jobName name of the job to be created.
- * @param jobXml the config.xml which should be used to create
- * the job.
+ * @param folder {@link FolderJob}
+ * @param jobName name of the job to be created.
+ * @param jobXml the config.xml which should be used to create
+ * the job.
* @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @throws IOException in case of an error.
*/
public void createJob(FolderJob folder, String jobName, String jobXml, Boolean crumbFlag) throws IOException {
@@ -391,9 +392,9 @@ public void createJob(FolderJob folder, String jobName, String jobXml, Boolean c
/**
* Create a view on the server using the provided xml
- *
+ *
* @param viewName name of the view to be created.
- * @param viewXml The configuration for the view.
+ * @param viewXml The configuration for the view.
* @throws IOException in case of an error.
*/
public void createView(String viewName, String viewXml) throws IOException {
@@ -403,10 +404,10 @@ public void createView(String viewName, String viewXml) throws IOException {
/**
* Create a view on the server using the provided xml.
*
- * @param viewName name of the view to be created.
- * @param viewXml The configuration for the view.
+ * @param viewName name of the view to be created.
+ * @param viewXml The configuration for the view.
* @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @throws IOException in case of an error.
*/
public void createView(String viewName, String viewXml, Boolean crumbFlag) throws IOException {
@@ -416,10 +417,10 @@ public void createView(String viewName, String viewXml, Boolean crumbFlag) throw
/**
* Create a view on the server using the provided xml and in the provided
* folder.
- *
- * @param folder {@link FolderJob}
+ *
+ * @param folder {@link FolderJob}
* @param viewName name of the view to be created.
- * @param viewXml The configuration for the view.
+ * @param viewXml The configuration for the view.
* @throws IOException in case of an error.
*/
public void createView(FolderJob folder, String viewName, String viewXml) throws IOException {
@@ -429,12 +430,12 @@ public void createView(FolderJob folder, String viewName, String viewXml) throws
/**
* Create a view on the server using the provided xml and in the provided
* folder.
- *
- * @param folder the folder.
- * @param viewName the view name.
- * @param viewXml the view xml.
+ *
+ * @param folder the folder.
+ * @param viewName the view name.
+ * @param viewXml the view xml.
* @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @throws IOException in case of an error.
*/
public void createView(FolderJob folder, String viewName, String viewXml, Boolean crumbFlag) throws IOException {
@@ -444,7 +445,7 @@ public void createView(FolderJob folder, String viewName, String viewXml, Boolea
/**
* Create a folder on the server (in the root)
- *
+ *
* @param folderName name of the folder.
* @throws IOException in case of an error.
*/
@@ -454,10 +455,10 @@ public void createFolder(String folderName) throws IOException {
/**
* Create a folder on the server (in the root)
- *
+ *
* @param folderName name of the folder.
- * @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * @param crumbFlag true to add crumbIssuer
+ * false otherwise.
* @throws IOException in case of an error.
*/
public void createFolder(String folderName, Boolean crumbFlag) throws IOException {
@@ -467,7 +468,7 @@ public void createFolder(String folderName, Boolean crumbFlag) throws IOExceptio
/**
* Create a job on the server (in the given folder)
*
- * @param folder {@link FolderJob}
+ * @param folder {@link FolderJob}
* @param jobName name of the job.
* @throws IOException in case of an error.
*/
@@ -478,10 +479,10 @@ public void createFolder(FolderJob folder, String jobName) throws IOException {
/**
* Create a job on the server (in the given folder)
*
- * @param folder {@link FolderJob}
- * @param jobName name of the job.
+ * @param folder {@link FolderJob}
+ * @param jobName name of the job.
* @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @throws IOException in case of an error.
*/
public void createFolder(FolderJob folder, String jobName, Boolean crumbFlag) throws IOException {
@@ -505,9 +506,9 @@ public String getJobXml(String jobName) throws IOException {
/**
* Get the xml description of an existing job.
- *
+ *
* @param jobName name of the job.
- * @param folder {@link FolderJob}
+ * @param folder {@link FolderJob}
* @return the new job object
* @throws IOException in case of an error.
*/
@@ -517,7 +518,7 @@ public String getJobXml(FolderJob folder, String jobName) throws IOException {
/**
* Get the description of an existing Label
- *
+ *
* @param labelName name of the label.
* @return {@link LabelWithDetails}
* @throws IOException in case of an error.
@@ -530,7 +531,7 @@ public LabelWithDetails getLabel(String labelName) throws IOException {
* Get a list of all the computers on the server (at the summary level)
*
* @return map of defined computers (summary level, for details @see
- * Computer#details
+ * Computer#details
* @throws IOException in case of an error.
*/
public Maptrue to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @throws IOException In case of an failure.
*/
public void deleteJob(String jobName, boolean crumbFlag) throws IOException {
@@ -717,7 +717,7 @@ public void deleteJob(String jobName, boolean crumbFlag) throws IOException {
/**
* Disable a job from jenkins
- *
+ *
* @param jobName The name of the job which should be disabled.
* @throws IOException in case of an error.
*/
@@ -728,9 +728,9 @@ public void disableJob(String jobName) throws IOException {
/**
* Disable a job from Jenkins.
*
- * @param jobName The name of the job to be deleted.
+ * @param jobName The name of the job to be deleted.
* @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @throws IOException In case of an failure.
*/
public void disableJob(String jobName, boolean crumbFlag) throws IOException {
@@ -739,20 +739,20 @@ public void disableJob(String jobName, boolean crumbFlag) throws IOException {
/**
* Enable a job from jenkins
- *
+ *
* @param jobName name of the job which should be enabled.
* @throws IOException In case of an failure.
*/
public void enableJob(String jobName) throws IOException {
- enableJob( jobName, false );
+ enableJob(jobName, false);
}
/**
* Enable a job from Jenkins.
*
- * @param jobName The name of the job to be deleted.
+ * @param jobName The name of the job to be deleted.
* @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @throws IOException In case of an failure.
*/
public void enableJob(String jobName, boolean crumbFlag) throws IOException {
@@ -761,9 +761,9 @@ public void enableJob(String jobName, boolean crumbFlag) throws IOException {
/**
* Runs the provided groovy script on the server and returns the result.
- *
+ * * This is similar to running groovy scripts using the script console. - * + *
* In the instance where your script causes an exception, the server still * returns a 200 status, so detecting errors is very challenging. It is * recommended to use heuristics to check your return string for stack @@ -779,17 +779,17 @@ public String runScript(String script) throws IOException { /** * Runs the provided groovy script on the server and returns the result. - * + *
* This is similar to running groovy scripts using the script console. - * + *
* In the instance where your script causes an exception, the server still
* returns a 200 status, so detecting errors is very challenging. It is
* recommended to use heuristics to check your return string for stack
* traces by detecting strings like "groovy.lang.(something)Exception".
*
- * @param script The script to run.
+ * @param script The script to run.
* @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * false otherwise.
* @return results The results of the run of the script.
* @throws IOException in case of an error.
*/
@@ -851,8 +851,8 @@ public void renameJob(String oldJobName, String newJobName) throws IOException {
*
* @param oldJobName existing job name.
* @param newJobName The new job name.
- * @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * @param crumbFlag true to add crumbIssuer
+ * false otherwise.
* @throws IOException In case of a failure.
*/
public void renameJob(String oldJobName, String newJobName, Boolean crumbFlag) throws IOException {
@@ -862,7 +862,7 @@ public void renameJob(String oldJobName, String newJobName, Boolean crumbFlag) t
/**
* Rename a job
*
- * @param folder {@link FolderJob}
+ * @param folder {@link FolderJob}
* @param oldJobName existing job name.
* @param newJobName The new job name.
* @throws IOException In case of a failure.
@@ -874,22 +874,21 @@ public void renameJob(FolderJob folder, String oldJobName, String newJobName) th
/**
* Rename a job
*
- * @param folder {@link FolderJob}
+ * @param folder {@link FolderJob}
* @param oldJobName existing job name.
* @param newJobName The new job name.
- * @param crumbFlag true to add crumbIssuer
- * false otherwise.
+ * @param crumbFlag true to add crumbIssuer
+ * false otherwise.
* @throws IOException In case of a failure.
*/
public void renameJob(FolderJob folder, String oldJobName, String newJobName, Boolean crumbFlag)
throws IOException {
- client.post(UrlUtils.toJobBaseUrl(folder, oldJobName)
- + "/doRename?newName=" + EncodingUtils.encodeParam(newJobName),
- crumbFlag);
+ client.post(UrlUtils.toJobBaseUrl(folder, oldJobName)
+ + "/doRename?newName=" + EncodingUtils.encodeParam(newJobName),
+ crumbFlag);
}
-
-
-
+
+
/**
* Closes underlying resources.
* Closed instances should no longer be used
@@ -901,74 +900,66 @@ public void close() {
}
- /**
- * Restart Jenkins without waiting for any existing build to complete
- *
- * @param crumbFlag
- * true to add crumbIssuer false
- * otherwise.
- * @throws IOException
- * in case of an error.
- */
- public void restart(Boolean crumbFlag) throws IOException {
- try {
- client.post("/restart", crumbFlag);
- } catch (org.apache.http.client.ClientProtocolException e) {
- LOGGER.error("restart()", e);
- }
- }
-
- /**
- * safeRestart: Puts Jenkins into the quiet mode, wait for existing builds
- * to be completed, and then restart Jenkins
- *
- * @param crumbFlag
- * true to add crumbIssuer false
- * otherwise.
- * @throws IOException
- * in case of an error.
- */
- public void safeRestart(Boolean crumbFlag) throws IOException {
- try {
- client.post("/safeRestart", crumbFlag);
- } catch (org.apache.http.client.ClientProtocolException e) {
- LOGGER.error("safeRestart()", e);
- }
- }
-
- /**
- * Shutdown Jenkins without waiting for any existing build to complete
- *
- * @param crumbFlag
- * true to add crumbIssuer false
- * otherwise.
- * @throws IOException
- * in case of an error.
- */
- //
- public void exit(Boolean crumbFlag) throws IOException {
- try {
- client.post("/exit", crumbFlag);
- } catch (org.apache.http.client.ClientProtocolException e) {
- LOGGER.error("exit()", e);
- }
- }
-
- /**
- * safeExit: Puts Jenkins into the quiet mode, wait for existing builds to
- * be completed, and then shut down Jenkins
- *
- * @param crumbFlag
- * true to add crumbIssuer false
- * otherwise.
- * @throws IOException
- * in case of an error.
- */
- public void safeExit(Boolean crumbFlag) throws IOException {
- try {
- client.post("/safeExit", crumbFlag);
- } catch (org.apache.http.client.ClientProtocolException e) {
- LOGGER.error("safeExit()", e);
- }
- }
+ /**
+ * Restart Jenkins without waiting for any existing build to complete
+ *
+ * @param crumbFlag true to add crumbIssuer false
+ * otherwise.
+ * @throws IOException in case of an error.
+ */
+ public void restart(Boolean crumbFlag) throws IOException {
+ try {
+ client.post("/restart", crumbFlag);
+ } catch (org.apache.http.client.ClientProtocolException e) {
+ LOGGER.error("restart()", e);
+ }
+ }
+
+ /**
+ * safeRestart: Puts Jenkins into the quiet mode, wait for existing builds
+ * to be completed, and then restart Jenkins
+ *
+ * @param crumbFlag true to add crumbIssuer false
+ * otherwise.
+ * @throws IOException in case of an error.
+ */
+ public void safeRestart(Boolean crumbFlag) throws IOException {
+ try {
+ client.post("/safeRestart", crumbFlag);
+ } catch (org.apache.http.client.ClientProtocolException e) {
+ LOGGER.error("safeRestart()", e);
+ }
+ }
+
+ /**
+ * Shutdown Jenkins without waiting for any existing build to complete
+ *
+ * @param crumbFlag true to add crumbIssuer false
+ * otherwise.
+ * @throws IOException in case of an error.
+ */
+ //
+ public void exit(Boolean crumbFlag) throws IOException {
+ try {
+ client.post("/exit", crumbFlag);
+ } catch (org.apache.http.client.ClientProtocolException e) {
+ LOGGER.error("exit()", e);
+ }
+ }
+
+ /**
+ * safeExit: Puts Jenkins into the quiet mode, wait for existing builds to
+ * be completed, and then shut down Jenkins
+ *
+ * @param crumbFlag true to add crumbIssuer false
+ * otherwise.
+ * @throws IOException in case of an error.
+ */
+ public void safeExit(Boolean crumbFlag) throws IOException {
+ try {
+ client.post("/safeExit", crumbFlag);
+ } catch (org.apache.http.client.ClientProtocolException e) {
+ LOGGER.error("safeExit()", e);
+ }
+ }
}
diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/model/DetailJobView.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/model/DetailJobView.java
new file mode 100644
index 00000000..9b2a7394
--- /dev/null
+++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/model/DetailJobView.java
@@ -0,0 +1,17 @@
+package com.offbytwo.jenkins.model;
+
+import java.util.List;
+
+public class DetailJobView extends BaseModel {
+
+ private List
*
- *
+ *
* Note: At the moment there seemed to be no option to get the number of
* existing builds for a job. The only option is to get all builds via
* {@link #getAllBuilds()}.
- *
+ *
* @param range {@link Range}
* @return the list of {@link Build}. In case of no builds have been
- * executed yet return {@link Collections#emptyList()}.
+ * executed yet return {@link Collections#emptyList()}.
* @throws IOException in case of an error.
*/
public Listtrue if a build has been run false
- * otherwise.
+ * otherwise.
*/
public boolean hasFirstBuildRun() {
if (firstBuild == null) {
@@ -234,7 +242,7 @@ public boolean hasFirstBuildRun() {
/**
* @return The lastBuild. If {@link #lastBuild} has never been run
- * {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
+ * {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
*/
public Build getLastBuild() {
if (lastBuild == null) {
@@ -246,9 +254,9 @@ public Build getLastBuild() {
/**
* Check if the {@link #lastBuild} has been run or not.
- *
+ *
* @return true if the last build has been run
- * false otherwise.
+ * false otherwise.
*/
public boolean hasLastBuildRun() {
if (lastBuild == null) {
@@ -260,7 +268,7 @@ public boolean hasLastBuildRun() {
/**
* @return The lastCompletedBuild. If {@link #lastCompletedBuild} has never
- * been run {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
+ * been run {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
*/
public Build getLastCompletedBuild() {
if (lastCompletedBuild == null) {
@@ -272,9 +280,9 @@ public Build getLastCompletedBuild() {
/**
* Check if the {@link #lastCompletedBuild} has been run or not.
- *
+ *
* @return true if the last completed build has been run
- * false otherwise.
+ * false otherwise.
*/
public boolean hasLastCompletedBuildRun() {
if (lastCompletedBuild == null) {
@@ -286,7 +294,7 @@ public boolean hasLastCompletedBuildRun() {
/**
* @return The lastFailedBuild. If {@link #lastFailedBuild} has never been
- * run {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
+ * run {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
*/
public Build getLastFailedBuild() {
if (lastFailedBuild == null) {
@@ -298,9 +306,9 @@ public Build getLastFailedBuild() {
/**
* Check if the {@link #lastFailedBuild} has been run or not.
- *
+ *
* @return true if the last failed build has been run
- * false otherwise.
+ * false otherwise.
*/
public boolean hasLastFailedBuildRun() {
if (lastFailedBuild == null) {
@@ -312,7 +320,7 @@ public boolean hasLastFailedBuildRun() {
/**
* @return The lastStableBuild. If {@link #lastStableBuild} has never been
- * run {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
+ * run {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
*/
public Build getLastStableBuild() {
if (lastStableBuild == null) {
@@ -324,9 +332,9 @@ public Build getLastStableBuild() {
/**
* Check if the {@link #lastStableBuild} has been run or not.
- *
+ *
* @return true if the last stable build has been run
- * false otherwise.
+ * false otherwise.
*/
public boolean hasLastStableBuildRun() {
if (lastStableBuild == null) {
@@ -338,8 +346,8 @@ public boolean hasLastStableBuildRun() {
/**
* @return The lastSuccessfulBuild. If {@link #lastSuccessfulBuild} has
- * never been run {@link Build#BUILD_HAS_NEVER_RUN} will be
- * returned.
+ * never been run {@link Build#BUILD_HAS_NEVER_RUN} will be
+ * returned.
*/
public Build getLastSuccessfulBuild() {
if (lastSuccessfulBuild == null) {
@@ -351,9 +359,9 @@ public Build getLastSuccessfulBuild() {
/**
* Check if the {@link #lastSuccessfulBuild} has been run or not.
- *
+ *
* @return true if the last successful build has been run
- * false otherwise.
+ * false otherwise.
*/
public boolean hasLastSuccessfulBuildRun() {
if (lastSuccessfulBuild == null) {
@@ -365,7 +373,7 @@ public boolean hasLastSuccessfulBuildRun() {
/**
* @return The lastUnstableBuild. If {@link #lastUnstableBuild} has never
- * been run {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
+ * been run {@link Build#BUILD_HAS_NEVER_RUN} will be returned.
*/
public Build getLastUnstableBuild() {
if (lastUnstableBuild == null) {
@@ -377,9 +385,9 @@ public Build getLastUnstableBuild() {
/**
* Check if the {@link #lastUnstableBuild} has been run or not.
- *
+ *
* @return true if the last unstable build has been run
- * false otherwise.
+ * false otherwise.
*/
public boolean hasLastUnstableBuildRun() {
if (lastUnstableBuild == null) {
@@ -391,8 +399,8 @@ public boolean hasLastUnstableBuildRun() {
/**
* @return The lastUnsuccessfulBuild. If {@link #lastUnsuccessfulBuild} has
- * never been run {@link Build#BUILD_HAS_NEVER_RUN} will be
- * returned.
+ * never been run {@link Build#BUILD_HAS_NEVER_RUN} will be
+ * returned.
*/
public Build getLastUnsuccessfulBuild() {
if (lastUnsuccessfulBuild == null) {
@@ -404,9 +412,9 @@ public Build getLastUnsuccessfulBuild() {
/**
* Check if the {@link #lastUnsuccessfulBuild} has been run or not.
- *
+ *
* @return true if the last unsuccessful build has been run
- * false otherwise.
+ * false otherwise.
*/
public boolean hasLastUnsuccessfulBuildRun() {
if (lastUnsuccessfulBuild == null) {
@@ -422,7 +430,7 @@ public int getNextBuildNumber() {
/**
* @return the list of downstream projects. If no downstream projects exist
- * just return an empty list {@link Collections#emptyList()}.
+ * just return an empty list {@link Collections#emptyList()}.
*/
public Listdescription of a Job.
- *
+ *
* @param description The description which should be set. If you like to
- * set an empty description you should use
- * {@link #EMPTY_DESCRIPTION}.
+ * set an empty description you should use
+ * {@link #EMPTY_DESCRIPTION}.
* @throws IOException in case of errors.
*/
public void updateDescription(String description) throws IOException {
@@ -498,11 +505,11 @@ public void updateDescription(String description) throws IOException {
/**
* Update the description of a Job.
- *
+ *
* @param description The description which should be set. If you like to
- * set an empty description you should use
- * {@link #EMPTY_DESCRIPTION}.
- * @param crumbFlag true or false.
+ * set an empty description you should use
+ * {@link #EMPTY_DESCRIPTION}.
+ * @param crumbFlag true or false.
* @throws IOException in case of errors.
*/
public void updateDescription(String description, boolean crumbFlag) throws IOException {
@@ -513,7 +520,7 @@ public void updateDescription(String description, boolean crumbFlag) throws IOEx
/**
* clear the description of a job.
- *
+ *
* @throws IOException in case of errors.
*/
public void clearDescription() throws IOException {
@@ -522,7 +529,7 @@ public void clearDescription() throws IOException {
/**
* clear the description of a job.
- *
+ *
* @param crumbFlag true or false.
* @throws IOException in case of errors.
*/
diff --git a/pom.xml b/pom.xml
index cea2c716..39d072b3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,6 +87,11 @@