Skip to content

Commit d4a4741

Browse files
committed
Fixed #198
o Enhanced QueueItem to add information about Task.
1 parent 3065129 commit d4a4741

File tree

3 files changed

+87
-6
lines changed

3 files changed

+87
-6
lines changed

ReleaseNotes.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public class MavenJobWithDetails {
5454
public MavenBuild getLastSuccessfulBuild();
5555
public MavenBuild getLastUnstableBuild();
5656
public MavenBuild getLastUnsuccessfulBuild();
57-
5857
}
5958
```
6059

@@ -71,6 +70,16 @@ public class MavenJobWithDetails {
7170
}
7271
```
7372

73+
* [Fixed Issue 198][issue-198]
74+
75+
Enhanced the `QueueItem` to add information about the task (QueueTask).
76+
77+
```java
78+
public class QueueItem {
79+
public QueueTask getTask();
80+
}
81+
```
82+
7483

7584
## Release 0.3.6
7685

@@ -662,6 +671,7 @@ TestReport testReport = mavenJob.getLastSuccessfulBuild().getTestReport();
662671
[issue-179]: https://github.com/jenkinsci/java-client-api/issues/179
663672
[issue-182]: https://github.com/jenkinsci/java-client-api/issues/182
664673
[issue-186]: https://github.com/jenkinsci/java-client-api/issues/186
674+
[issue-198]: https://github.com/jenkinsci/java-client-api/issues/198
665675
[issue-201]: https://github.com/jenkinsci/java-client-api/issues/201
666676
[issue-202]: https://github.com/jenkinsci/java-client-api/issues/202
667677
[pull-123]: https://github.com/jenkinsci/java-client-api/pull/123

jenkins-client/src/main/java/com/offbytwo/jenkins/model/QueueItem.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ public class QueueItem extends BaseModel {
1515

1616
private boolean stuck;
1717

18-
// task
19-
// name
20-
// url
21-
// color?
18+
private QueueTask task;
2219

2320
private String url;
24-
21+
2522
private String why;
2623

2724
private boolean cancelled;
@@ -72,6 +69,14 @@ public boolean isStuck() {
7269
return stuck;
7370
}
7471

72+
public QueueTask getTask() {
73+
return task;
74+
}
75+
76+
public void setTask(QueueTask task) {
77+
this.task = task;
78+
}
79+
7580
public void setStuck(boolean stuck) {
7681
this.stuck = stuck;
7782
}
@@ -120,6 +125,7 @@ public int hashCode() {
120125
result = prime * result + ((inQueueSince == null) ? 0 : inQueueSince.hashCode());
121126
result = prime * result + ((params == null) ? 0 : params.hashCode());
122127
result = prime * result + (stuck ? 1231 : 1237);
128+
result = prime * result + ((task == null) ? 0 : task.hashCode());
123129
result = prime * result + ((url == null) ? 0 : url.hashCode());
124130
result = prime * result + ((why == null) ? 0 : why.hashCode());
125131
return result;
@@ -162,6 +168,11 @@ public boolean equals(Object obj) {
162168
return false;
163169
if (stuck != other.stuck)
164170
return false;
171+
if (task == null) {
172+
if (other.task != null)
173+
return false;
174+
} else if (!task.equals(other.task))
175+
return false;
165176
if (url == null) {
166177
if (other.url != null)
167178
return false;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.offbytwo.jenkins.model;
2+
3+
public class QueueTask {
4+
5+
private String name;
6+
7+
private String url;
8+
9+
private String color;
10+
11+
public String getName() {
12+
return name;
13+
}
14+
15+
public String getUrl() {
16+
return url;
17+
}
18+
19+
public String getColor() {
20+
return color;
21+
}
22+
23+
@Override
24+
public int hashCode() {
25+
final int prime = 31;
26+
int result = 1;
27+
result = prime * result + ((color == null) ? 0 : color.hashCode());
28+
result = prime * result + ((name == null) ? 0 : name.hashCode());
29+
result = prime * result + ((url == null) ? 0 : url.hashCode());
30+
return result;
31+
}
32+
33+
@Override
34+
public boolean equals(Object obj) {
35+
if (this == obj)
36+
return true;
37+
if (obj == null)
38+
return false;
39+
if (getClass() != obj.getClass())
40+
return false;
41+
QueueTask other = (QueueTask) obj;
42+
if (color == null) {
43+
if (other.color != null)
44+
return false;
45+
} else if (!color.equals(other.color))
46+
return false;
47+
if (name == null) {
48+
if (other.name != null)
49+
return false;
50+
} else if (!name.equals(other.name))
51+
return false;
52+
if (url == null) {
53+
if (other.url != null)
54+
return false;
55+
} else if (!url.equals(other.url))
56+
return false;
57+
return true;
58+
}
59+
60+
}

0 commit comments

Comments
 (0)