Skip to content

Commit f63e2d9

Browse files
committed
Create AbstractIssue
1 parent 4041ae7 commit f63e2d9

File tree

5 files changed

+410
-361
lines changed

5 files changed

+410
-361
lines changed

src/main/java/org/gitlab4j/api/IssuesApi.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.gitlab4j.api.models.IssuesStatistics;
1818
import org.gitlab4j.api.models.IssuesStatisticsFilter;
1919
import org.gitlab4j.api.models.LinkType;
20+
import org.gitlab4j.api.models.LinkedIssue;
2021
import org.gitlab4j.api.models.MergeRequest;
2122
import org.gitlab4j.api.models.Participant;
2223
import org.gitlab4j.api.models.TimeStats;
@@ -834,7 +835,7 @@ public Stream<MergeRequest> getClosedByMergeRequestsStream(Object projectIdOrPat
834835
* @return a list of related issues of a given issue, sorted by the relationship creation datetime (ascending)
835836
* @throws GitLabApiException if any exception occurs
836837
*/
837-
public List<Issue> getIssueLinks(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
838+
public List<LinkedIssue> getIssueLinks(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
838839
return (getIssueLinks(projectIdOrPath, issueIid, getDefaultPerPage()).all());
839840
}
840841

@@ -852,8 +853,8 @@ public List<Issue> getIssueLinks(Object projectIdOrPath, Long issueIid) throws G
852853
* @return a Pager of related issues of a given issue, sorted by the relationship creation datetime (ascending)
853854
* @throws GitLabApiException if any exception occurs
854855
*/
855-
public Pager<Issue> getIssueLinks(Object projectIdOrPath, Long issueIid, int itemsPerPage) throws GitLabApiException {
856-
return (new Pager<Issue>(this, Issue.class, itemsPerPage, null,
856+
public Pager<LinkedIssue> getIssueLinks(Object projectIdOrPath, Long issueIid, int itemsPerPage) throws GitLabApiException {
857+
return (new Pager<LinkedIssue>(this, LinkedIssue.class, itemsPerPage, null,
857858
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "links"));
858859
}
859860

@@ -870,7 +871,7 @@ public Pager<Issue> getIssueLinks(Object projectIdOrPath, Long issueIid, int ite
870871
* @return a Stream of related issues of a given issue, sorted by the relationship creation datetime (ascending)
871872
* @throws GitLabApiException if any exception occurs
872873
*/
873-
public Stream<Issue> getIssueLinksStream(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
874+
public Stream<LinkedIssue> getIssueLinksStream(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
874875
return (getIssueLinks(projectIdOrPath, issueIid, getDefaultPerPage()).stream());
875876
}
876877

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,340 @@
1+
2+
package org.gitlab4j.api.models;
3+
4+
import java.util.Date;
5+
import java.util.List;
6+
7+
import org.gitlab4j.api.Constants.IssueState;
8+
import org.gitlab4j.api.utils.JacksonJson;
9+
10+
import com.fasterxml.jackson.annotation.JsonIgnore;
11+
import com.fasterxml.jackson.annotation.JsonProperty;
12+
import com.fasterxml.jackson.databind.node.IntNode;
13+
import com.fasterxml.jackson.databind.node.LongNode;
14+
import com.fasterxml.jackson.databind.node.TextNode;
15+
import com.fasterxml.jackson.databind.node.ValueNode;
16+
17+
public abstract class AbstractIssue {
18+
19+
public static class TaskCompletionStatus {
20+
21+
private Integer count;
22+
private Integer completedCount;
23+
24+
public Integer getCount() {
25+
return count;
26+
}
27+
28+
public void setCount(Integer count) {
29+
this.count = count;
30+
}
31+
32+
public Integer getCompletedCount() {
33+
return completedCount;
34+
}
35+
36+
public void setCompletedCount(Integer completedCount) {
37+
this.completedCount = completedCount;
38+
}
39+
40+
@Override
41+
public String toString() {
42+
return (JacksonJson.toJsonString(this));
43+
}
44+
}
45+
46+
private Assignee assignee;
47+
private List<Assignee> assignees;
48+
private Author author;
49+
private Boolean confidential;
50+
private Date createdAt;
51+
private Date updatedAt;
52+
private Date closedAt;
53+
private User closedBy;
54+
private String description;
55+
private Date dueDate;
56+
57+
@JsonProperty("id")
58+
private ValueNode actualId;
59+
@JsonIgnore
60+
private String externalId;
61+
@JsonIgnore
62+
private Long id;
63+
64+
private Long iid;
65+
private List<String> labels;
66+
private Milestone milestone;
67+
private Long projectId;
68+
private IssueState state;
69+
private String title;
70+
private Integer userNotesCount;
71+
private String webUrl;
72+
private Integer weight;
73+
private Boolean discussionLocked;
74+
private TimeStats timeStats;
75+
76+
private Integer upvotes;
77+
private Integer downvotes;
78+
private Integer mergeRequestsCount;
79+
private Boolean hasTasks;
80+
private String taskStatus;
81+
private TaskCompletionStatus taskCompletionStatus;
82+
83+
public Assignee getAssignee() {
84+
return assignee;
85+
}
86+
87+
public void setAssignee(Assignee assignee) {
88+
this.assignee = assignee;
89+
}
90+
91+
public List<Assignee> getAssignees() {
92+
return assignees;
93+
}
94+
95+
public void setAssignees(List<Assignee> assignees) {
96+
this.assignees = assignees;
97+
}
98+
99+
public Author getAuthor() {
100+
return author;
101+
}
102+
103+
public void setAuthor(Author author) {
104+
this.author = author;
105+
}
106+
107+
public Boolean getConfidential() {
108+
return confidential;
109+
}
110+
111+
public void setConfidential(Boolean confidential) {
112+
this.confidential = confidential;
113+
}
114+
115+
public Date getCreatedAt() {
116+
return createdAt;
117+
}
118+
119+
public void setCreatedAt(Date createdAt) {
120+
this.createdAt = createdAt;
121+
}
122+
123+
public String getDescription() {
124+
return description;
125+
}
126+
127+
public void setDescription(String description) {
128+
this.description = description;
129+
}
130+
131+
public Date getDueDate() {
132+
return dueDate;
133+
}
134+
135+
public void setDueDate(Date dueDate) {
136+
this.dueDate = dueDate;
137+
}
138+
139+
public ValueNode getActualId() {
140+
return actualId;
141+
}
142+
143+
public void setActualId(ValueNode id) {
144+
actualId = id;
145+
if (actualId instanceof TextNode) {
146+
externalId = actualId.asText();
147+
} else if (actualId instanceof IntNode || actualId instanceof LongNode) {
148+
this.id = actualId.asLong();
149+
}
150+
}
151+
152+
public Long getId() {
153+
return (id);
154+
}
155+
156+
public void setId(Long id) {
157+
this.id = id;
158+
if (id != null) {
159+
actualId = new LongNode(id);
160+
externalId = null;
161+
}
162+
}
163+
164+
public String getExternalId() {
165+
return (externalId);
166+
}
167+
168+
public void setExternalId(String externalId) {
169+
this.externalId = externalId;
170+
if (externalId != null) {
171+
actualId = new TextNode(externalId);
172+
id = null;
173+
}
174+
}
175+
176+
public Long getIid() {
177+
return iid;
178+
}
179+
180+
public void setIid(Long iid) {
181+
this.iid = iid;
182+
}
183+
184+
public List<String> getLabels() {
185+
return labels;
186+
}
187+
188+
public void setLabels(List<String> labels) {
189+
this.labels = labels;
190+
}
191+
192+
public Milestone getMilestone() {
193+
return milestone;
194+
}
195+
196+
public void setMilestone(Milestone milestone) {
197+
this.milestone = milestone;
198+
}
199+
200+
public Long getProjectId() {
201+
return projectId;
202+
}
203+
204+
public void setProjectId(Long projectId) {
205+
this.projectId = projectId;
206+
}
207+
208+
public IssueState getState() {
209+
return state;
210+
}
211+
212+
public void setState(IssueState state) {
213+
this.state = state;
214+
}
215+
216+
public String getTitle() {
217+
return title;
218+
}
219+
220+
public void setTitle(String title) {
221+
this.title = title;
222+
}
223+
224+
public Date getUpdatedAt() {
225+
return updatedAt;
226+
}
227+
228+
public void setUpdatedAt(Date updatedAt) {
229+
this.updatedAt = updatedAt;
230+
}
231+
232+
public Date getClosedAt() {
233+
return closedAt;
234+
}
235+
236+
public void setClosedAt(Date closedAt) {
237+
this.closedAt = closedAt;
238+
}
239+
240+
public User getClosedBy() {
241+
return closedBy;
242+
}
243+
244+
public void setClosedBy(User closedBy) {
245+
this.closedBy = closedBy;
246+
}
247+
248+
public Integer getUserNotesCount() {
249+
return userNotesCount;
250+
}
251+
252+
public void setUserNotesCount(Integer userNotesCount) {
253+
this.userNotesCount = userNotesCount;
254+
}
255+
256+
public String getWebUrl() {
257+
return webUrl;
258+
}
259+
260+
public void setWebUrl(String webUrl) {
261+
this.webUrl = webUrl;
262+
}
263+
264+
public Integer getWeight() {
265+
return weight;
266+
}
267+
268+
public void setWeight(Integer weight) {
269+
this.weight = weight;
270+
}
271+
272+
public Boolean getDiscussionLocked() {
273+
return discussionLocked;
274+
}
275+
276+
public void setDiscussionLocked(Boolean discussionLocked) {
277+
this.discussionLocked = discussionLocked;
278+
}
279+
280+
public TimeStats getTimeStats() {
281+
return timeStats;
282+
}
283+
284+
public void setTimeStats(TimeStats timeStats) {
285+
this.timeStats = timeStats;
286+
}
287+
288+
public Integer getUpvotes() {
289+
return upvotes;
290+
}
291+
292+
public void setUpvotes(Integer upvotes) {
293+
this.upvotes = upvotes;
294+
}
295+
296+
public Integer getDownvotes() {
297+
return downvotes;
298+
}
299+
300+
public void setDownvotes(Integer downvotes) {
301+
this.downvotes = downvotes;
302+
}
303+
304+
public Integer getMergeRequestsCount() {
305+
return mergeRequestsCount;
306+
}
307+
308+
public void setMergeRequestsCount(Integer mergeRequestsCount) {
309+
this.mergeRequestsCount = mergeRequestsCount;
310+
}
311+
312+
public Boolean getHasTasks() {
313+
return hasTasks;
314+
}
315+
316+
public void setHasTasks(Boolean hasTasks) {
317+
this.hasTasks = hasTasks;
318+
}
319+
320+
public String getTaskStatus() {
321+
return taskStatus;
322+
}
323+
324+
public void setTaskStatus(String taskStatus) {
325+
this.taskStatus = taskStatus;
326+
}
327+
328+
public TaskCompletionStatus getTaskCompletionStatus() {
329+
return taskCompletionStatus;
330+
}
331+
332+
public void setTaskCompletionStatus(TaskCompletionStatus taskCompletionStatus) {
333+
this.taskCompletionStatus = taskCompletionStatus;
334+
}
335+
336+
@Override
337+
public String toString() {
338+
return (JacksonJson.toJsonString(this));
339+
}
340+
}

0 commit comments

Comments
 (0)