Skip to content

Commit 73c78a1

Browse files
authored
Add missing attributes on Epic (#961)
Fixes #887
1 parent 407166a commit 73c78a1

File tree

2 files changed

+210
-4
lines changed

2 files changed

+210
-4
lines changed

src/main/java/org/gitlab4j/api/models/Epic.java

Lines changed: 181 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,66 @@
22

33
import java.util.Date;
44
import java.util.List;
5+
import java.util.Map;
56

7+
import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
68
import org.gitlab4j.api.utils.JacksonJson;
79

10+
import com.fasterxml.jackson.annotation.JsonCreator;
11+
import com.fasterxml.jackson.annotation.JsonIgnore;
12+
import com.fasterxml.jackson.annotation.JsonProperty;
13+
import com.fasterxml.jackson.annotation.JsonValue;
14+
815
public class Epic {
916

17+
public enum EpicState {
18+
OPENED, CLOSED, ALL;
19+
20+
private static JacksonJsonEnumHelper<EpicState> enumHelper = new JacksonJsonEnumHelper<>(EpicState.class);
21+
22+
@JsonCreator
23+
public static EpicState forValue(String value) {
24+
return enumHelper.forValue(value);
25+
}
26+
27+
@JsonValue
28+
public String toValue() {
29+
return (enumHelper.toString(this));
30+
}
31+
32+
public String toString() {
33+
return (enumHelper.toString(this));
34+
}
35+
}
36+
1037
private Long id;
1138
private Long iid;
1239
private Long groupId;
40+
private Long parentId;
41+
private Long parentIid;
1342
private String title;
1443
private String description;
44+
private EpicState state;
45+
private String webUrl;
46+
private String reference;
47+
private References references;
1548
private Author author;
1649
private List<String> labels;
1750
private Date startDate;
51+
private Boolean startDateIsFixed;
52+
private Date dueDate;
53+
private Boolean dueDateIsFixed;
54+
private Date dueDateFromInheritedSource;
1855
private Date endDate;
1956
private Date createdAt;
2057
private Date updatedAt;
58+
private Date closedAt;
59+
private Integer downvotes;
60+
private Integer upvotes;
61+
private String color;
62+
private Boolean subscribed;
63+
@JsonProperty("_links")
64+
private Map<String, String> links;
2165

2266
public Long getId() {
2367
return id;
@@ -43,6 +87,22 @@ public void setGroupId(Long groupId) {
4387
this.groupId = groupId;
4488
}
4589

90+
public Long getParentId() {
91+
return parentId;
92+
}
93+
94+
public void setParentId(Long parentId) {
95+
this.parentId = parentId;
96+
}
97+
98+
public Long getParentIid() {
99+
return parentIid;
100+
}
101+
102+
public void setParentIid(Long parentIid) {
103+
this.parentIid = parentIid;
104+
}
105+
46106
public String getTitle() {
47107
return title;
48108
}
@@ -69,6 +129,38 @@ public Epic withDescription(String description) {
69129
return (this);
70130
}
71131

132+
public EpicState getState() {
133+
return state;
134+
}
135+
136+
public void setState(EpicState state) {
137+
this.state = state;
138+
}
139+
140+
public String getWebUrl() {
141+
return webUrl;
142+
}
143+
144+
public void setWebUrl(String webUrl) {
145+
this.webUrl = webUrl;
146+
}
147+
148+
public String getReference() {
149+
return reference;
150+
}
151+
152+
public void setReference(String reference) {
153+
this.reference = reference;
154+
}
155+
156+
public References getReferences() {
157+
return references;
158+
}
159+
160+
public void setReferences(References references) {
161+
this.references = references;
162+
}
163+
72164
public Author getAuthor() {
73165
return author;
74166
}
@@ -108,6 +200,38 @@ public Epic withStartDate(Date startDate) {
108200
return (this);
109201
}
110202

203+
public Boolean getStartDateIsFixed() {
204+
return startDateIsFixed;
205+
}
206+
207+
public void setStartDateIsFixed(Boolean startDateIsFixed) {
208+
this.startDateIsFixed = startDateIsFixed;
209+
}
210+
211+
public Date getDueDate() {
212+
return dueDate;
213+
}
214+
215+
public void setDueDate(Date dueDate) {
216+
this.dueDate = dueDate;
217+
}
218+
219+
public Boolean getDueDateIsFixed() {
220+
return dueDateIsFixed;
221+
}
222+
223+
public void setDueDateIsFixed(Boolean dueDateIsFixed) {
224+
this.dueDateIsFixed = dueDateIsFixed;
225+
}
226+
227+
public Date getDueDateFromInheritedSource() {
228+
return dueDateFromInheritedSource;
229+
}
230+
231+
public void setDueDateFromInheritedSource(Date dueDateFromInheritedSource) {
232+
this.dueDateFromInheritedSource = dueDateFromInheritedSource;
233+
}
234+
111235
public Date getEndDate() {
112236
return endDate;
113237
}
@@ -137,7 +261,63 @@ public void setUpdatedAt(Date updatedAt) {
137261
this.updatedAt = updatedAt;
138262
}
139263

140-
@Override
264+
public Date getClosedAt() {
265+
return closedAt;
266+
}
267+
268+
public void setClosedAt(Date closedAt) {
269+
this.closedAt = closedAt;
270+
}
271+
272+
public Integer getDownvotes() {
273+
return downvotes;
274+
}
275+
276+
public void setDownvotes(Integer downvotes) {
277+
this.downvotes = downvotes;
278+
}
279+
280+
public Integer getUpvotes() {
281+
return upvotes;
282+
}
283+
284+
public void setUpvotes(Integer upvotes) {
285+
this.upvotes = upvotes;
286+
}
287+
288+
public String getColor() {
289+
return color;
290+
}
291+
292+
public void setColor(String color) {
293+
this.color = color;
294+
}
295+
296+
public Boolean getSubscribed() {
297+
return subscribed;
298+
}
299+
300+
public void setSubscribed(Boolean subscribed) {
301+
this.subscribed = subscribed;
302+
}
303+
304+
public Map<String, String> getLinks() {
305+
return links;
306+
}
307+
308+
public void setLinks(Map<String, String> links) {
309+
this.links = links;
310+
}
311+
312+
@JsonIgnore
313+
public String getLinkByName(String name) {
314+
if (links == null || links.isEmpty()) {
315+
return (null);
316+
}
317+
318+
return (links.get(name));
319+
}
320+
141321
public String toString() {
142322
return (JacksonJson.toJsonString(this));
143323
}

src/test/resources/org/gitlab4j/api/epic.json

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,42 @@
22
"id": 30,
33
"iid": 5,
44
"group_id": 7,
5+
"parent_id": 3,
6+
"parent_iid": 8,
57
"title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
68
"description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
9+
"state": "opened",
10+
"web_url": "http://gitlab.example.com/groups/test/-/epics/5",
11+
"reference": "&5",
12+
"references": {
13+
"short": "&5",
14+
"relative": "&5",
15+
"full": "test&5"
16+
},
717
"author":{
818
"id": 7,
919
"name": "Pamella Huel",
1020
"username": "arnita",
1121
"state": "active",
1222
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
13-
"web_url": "http://localhost:3001/arnita"
23+
"web_url": "http://gitlab.example.com/arnita"
1424
},
15-
"created_at": "2018-01-21T06:21:13.165Z",
16-
"updated_at": "2018-01-22T12:41:41.166Z"
25+
"start_date": "2018-07-01T00:00:00Z",
26+
"start_date_is_fixed": false,
27+
"due_date": "2018-07-31T00:00:00Z",
28+
"due_date_is_fixed": false,
29+
"due_date_from_inherited_source": "2018-07-31T00:00:00Z",
30+
"created_at": "2018-07-17T13:36:22.770Z",
31+
"updated_at": "2018-07-18T12:22:05.239Z",
32+
"closed_at": "2018-08-18T12:22:05.239Z",
33+
"labels": [],
34+
"upvotes": 4,
35+
"downvotes": 0,
36+
"color": "#1068bf",
37+
"subscribed": true,
38+
"_links":{
39+
"self": "http://gitlab.example.com/api/v4/groups/7/epics/5",
40+
"epic_issues": "http://gitlab.example.com/api/v4/groups/7/epics/5/issues",
41+
"group":"http://gitlab.example.com/api/v4/groups/7"
42+
}
1743
}

0 commit comments

Comments
 (0)