25
25
*/
26
26
public class BuildWithDetails extends Build {
27
27
28
+ /**
29
+ * This will be returned by the API in cases where the build has never run.
30
+ * For example {@link Build#BUILD_HAS_NEVER_RUN}
31
+ */
32
+ public static final BuildWithDetails BUILD_HAS_NEVER_RUN = new BuildWithDetails () {
33
+
34
+ @ Override
35
+ public List getActions () {
36
+ return Collections .emptyList ();
37
+ }
38
+
39
+ @ Override
40
+ public List <Artifact > getArtifacts () {
41
+ return Collections .<Artifact >emptyList ();
42
+ }
43
+
44
+ @ Override
45
+ public List <BuildCause > getCauses () {
46
+ return Collections .<BuildCause >emptyList ();
47
+ }
48
+
49
+ @ Override
50
+ public List <BuildChangeSetAuthor > getCulprits () {
51
+ return Collections .<BuildChangeSetAuthor >emptyList ();
52
+ }
53
+
54
+ @ Override
55
+ public BuildResult getResult () {
56
+ return BuildResult .NOT_BUILT ;
57
+ }
58
+
59
+ };
60
+
61
+ /**
62
+ * This will be returned by the API in cases where the build has been
63
+ * cancelled. For example {@link Build#BUILD_HAS_BEEN_CANCELLED}
64
+ */
65
+ public static final BuildWithDetails BUILD_HAS_BEEN_CANCELLED = new BuildWithDetails () {
66
+
67
+ @ Override
68
+ public List getActions () {
69
+ return Collections .emptyList ();
70
+ }
71
+
72
+ @ Override
73
+ public List <Artifact > getArtifacts () {
74
+ return Collections .<Artifact >emptyList ();
75
+ }
76
+
77
+ @ Override
78
+ public List <BuildCause > getCauses () {
79
+ return Collections .<BuildCause >emptyList ();
80
+ }
81
+
82
+ @ Override
83
+ public List <BuildChangeSetAuthor > getCulprits () {
84
+ return Collections .<BuildChangeSetAuthor >emptyList ();
85
+ }
86
+
87
+ @ Override
88
+ public BuildResult getResult () {
89
+ return BuildResult .CANCELLED ;
90
+ }
91
+
92
+ };
93
+
28
94
private List actions ; // TODO: Should be improved.
29
95
private boolean building ;
30
96
private String description ;
@@ -103,7 +169,9 @@ public boolean apply(Map<String, Object> action) {
103
169
}
104
170
105
171
/**
106
- * Update <code>displayName</code> and the <code>description</code> of a build.
172
+ * Update <code>displayName</code> and the <code>description</code> of a
173
+ * build.
174
+ *
107
175
* @param displayName The new displayName which should be set.
108
176
* @param description The description which should be set.
109
177
* @param crumbFlag <code>true</code> or <code>false</code>.
@@ -113,14 +181,16 @@ public void updateDisplayNameAndDescription(String displayName, String descripti
113
181
throws IOException {
114
182
Objects .requireNonNull (displayName , "displayName is not allowed to be null." );
115
183
Objects .requireNonNull (description , "description is not allowed to be null." );
116
- //TODO: Check what the "core:apply" means?
184
+ // TODO: Check what the "core:apply" means?
117
185
ImmutableMap <String , String > params = ImmutableMap .of ("displayName" , displayName , "description" , description ,
118
186
"core:apply" , "" , "Submit" , "Save" );
119
187
client .post_form (this .getUrl () + "/configSubmit?" , params , crumbFlag );
120
188
}
121
189
122
190
/**
123
- * Update <code>displayName</code> and the <code>description</code> of a build.
191
+ * Update <code>displayName</code> and the <code>description</code> of a
192
+ * build.
193
+ *
124
194
* @param displayName The new displayName which should be set.
125
195
* @param description The description which should be set.
126
196
* @throws IOException in case of errors.
@@ -131,21 +201,23 @@ public void updateDisplayNameAndDescription(String displayName, String descripti
131
201
132
202
/**
133
203
* Update <code>displayName</code> of a build.
204
+ *
134
205
* @param displayName The new displayName which should be set.
135
206
* @param crumbFlag <code>true</code> or <code>false</code>.
136
207
* @throws IOException in case of errors.
137
208
*/
138
209
public void updateDisplayName (String displayName , boolean crumbFlag ) throws IOException {
139
210
Objects .requireNonNull (displayName , "displayName is not allowed to be null." );
140
211
String description = getDescription () == null ? "" : getDescription ();
141
- //TODO: Check what the "core:apply" means?
142
- ImmutableMap <String , String > params = ImmutableMap .of ("displayName" , displayName , "description" ,
143
- description , "core:apply" , "" , "Submit" , "Save" );
212
+ // TODO: Check what the "core:apply" means?
213
+ ImmutableMap <String , String > params = ImmutableMap .of ("displayName" , displayName , "description" , description ,
214
+ "core:apply" , "" , "Submit" , "Save" );
144
215
client .post_form (this .getUrl () + "/configSubmit?" , params , crumbFlag );
145
216
}
146
217
147
218
/**
148
219
* Update <code>displayName</code> of a build.
220
+ *
149
221
* @param displayName The new displayName which should be set.
150
222
* @throws IOException in case of errors.
151
223
*/
@@ -155,21 +227,23 @@ public void updateDisplayName(String displayName) throws IOException {
155
227
156
228
/**
157
229
* Update the <code>description</code> of a build.
230
+ *
158
231
* @param description The description which should be set.
159
232
* @param crumbFlag <code>true</code> or <code>false</code>.
160
233
* @throws IOException in case of errors.
161
234
*/
162
235
public void updateDescription (String description , boolean crumbFlag ) throws IOException {
163
236
Objects .requireNonNull (description , "description is not allowed to be null." );
164
237
String displayName = getDisplayName () == null ? "" : getDisplayName ();
165
- //TODO: Check what the "core:apply" means?
166
- ImmutableMap <String , String > params = ImmutableMap .of ("displayName" , displayName , "description" ,
167
- description , "core:apply" , "" , "Submit" , "Save" );
238
+ // TODO: Check what the "core:apply" means?
239
+ ImmutableMap <String , String > params = ImmutableMap .of ("displayName" , displayName , "description" , description ,
240
+ "core:apply" , "" , "Submit" , "Save" );
168
241
client .post_form (this .getUrl () + "/configSubmit?" , params , crumbFlag );
169
242
}
170
243
171
244
/**
172
245
* Update the <code>description</code> of a build.
246
+ *
173
247
* @param description The description which should be set.
174
248
* @throws IOException in case of errors.
175
249
*/
@@ -278,15 +352,15 @@ public boolean apply(Map<String, Object> action) {
278
352
/**
279
353
* @return The console output of the build. The line separation is done by
280
354
* {@code CR+LF}.
281
- * @throws IOException
282
- * in case of a failure.
355
+ * @throws IOException in case of a failure.
283
356
*/
284
357
public String getConsoleOutputText () throws IOException {
285
358
return client .get (getUrl () + "/logText/progressiveText" );
286
359
}
287
360
288
361
/**
289
362
* The console output with HTML.
363
+ *
290
364
* @return The console output as HTML.
291
365
* @throws IOException
292
366
*/
0 commit comments