File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
jenkins-client/src/main/java/com/offbytwo/jenkins/model Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 54
54
55
55
Add the crumbFlag as the 2nd parameter of getConsoleOutputText method
56
56
57
+ * [ JENKINS-56186] [ jissue-56186 ]
58
+
59
+ Added labels to computers
60
+
61
+ ``` java
62
+ ComputerWithDetails computer = ...
63
+ for (ComputerLabel assignedLabel : computer. getAssignedLabels()) {
64
+ assignedLabel. getName()
65
+ }
66
+ ```
67
+
57
68
## Release 0.3.8
58
69
59
70
* [ Fixed Issue 289] [ issue-289 ]
Original file line number Diff line number Diff line change
1
+ package com .offbytwo .jenkins .model ;
2
+
3
+ public class ComputerLabel {
4
+ private String name ;
5
+
6
+ public String getName () {
7
+ return name ;
8
+ }
9
+
10
+ @ Override
11
+ public int hashCode () {
12
+ final int prime = 31 ;
13
+ int result = 1 ;
14
+ result = prime * result + ((name == null ) ? 0 : name .hashCode ());
15
+ return result ;
16
+ }
17
+
18
+ @ Override
19
+ public boolean equals (Object obj ) {
20
+ if (this == obj )
21
+ return true ;
22
+ if (obj == null )
23
+ return false ;
24
+ if (getClass () != obj .getClass ())
25
+ return false ;
26
+ ComputerLabel other = (ComputerLabel ) obj ;
27
+ if (name == null ) {
28
+ if (other .name != null )
29
+ return false ;
30
+ } else if (!name .equals (other .name ))
31
+ return false ;
32
+ return true ;
33
+ }
34
+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ public class ComputerWithDetails extends Computer {
18
18
private String displayName ;
19
19
private List actions ; //TODO: What kind of List?
20
20
private List <Executor > executors ;
21
+ private List <ComputerLabel > assignedLabels ;
21
22
private Boolean idle ;
22
23
private Boolean jnlp ;
23
24
private Boolean launchSupported ;
@@ -46,6 +47,10 @@ public List<Executor> getExecutors() {
46
47
return executors ;
47
48
}
48
49
50
+ public List <ComputerLabel > getAssignedLabels () {
51
+ return assignedLabels ;
52
+ }
53
+
49
54
public Boolean getIdle () {
50
55
return idle ;
51
56
}
@@ -169,6 +174,11 @@ public boolean equals(Object obj) {
169
174
return false ;
170
175
} else if (!executors .equals (other .executors ))
171
176
return false ;
177
+ if (assignedLabels == null ) {
178
+ if (other .assignedLabels != null )
179
+ return false ;
180
+ } else if (!assignedLabels .equals (other .assignedLabels ))
181
+ return false ;
172
182
if (idle == null ) {
173
183
if (other .idle != null )
174
184
return false ;
You can’t perform that action at this time.
0 commit comments