Skip to content

Commit 2f4d812

Browse files
committedJun 14, 2023
Merge branch 'main' into 6.x
2 parents e19ea7f + 5aa8a75 commit 2f4d812

File tree

14 files changed

+927
-279
lines changed

14 files changed

+927
-279
lines changed
 

‎src/main/java/org/gitlab4j/api/EpicsApi.java

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@
99
import jakarta.ws.rs.core.GenericType;
1010
import jakarta.ws.rs.core.Response;
1111

12+
import org.gitlab4j.api.models.ChildEpic;
13+
import org.gitlab4j.api.models.CreatedChildEpic;
1214
import org.gitlab4j.api.models.Epic;
1315
import org.gitlab4j.api.models.EpicIssue;
1416
import org.gitlab4j.api.models.EpicIssueLink;
17+
import org.gitlab4j.api.models.LinkType;
18+
import org.gitlab4j.api.models.RelatedEpic;
19+
import org.gitlab4j.api.models.RelatedEpicLink;
1520

1621
/**
1722
* This class implements the client side API for the GitLab Epics and Epic Issues API calls.
@@ -458,4 +463,208 @@ public List<EpicIssue> updateIssue(Object groupIdOrPath, Long epicIid, Long epic
458463
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "issues", epicIssueId);
459464
return response.readEntity(new GenericType<List<EpicIssue>>() {});
460465
}
466+
467+
/**
468+
* Gets all child epics of an epic and the authenticated user has access to.
469+
*
470+
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/epics</code></pre>
471+
*
472+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
473+
* @param epicIid the IID of the epic to get child epics for
474+
* @return a list of all child epics of the specified epic
475+
* @throws GitLabApiException if any exception occurs
476+
*/
477+
public List<ChildEpic> getChildEpics(Object groupIdOrPath, Long epicIid) throws GitLabApiException {
478+
return (getChildEpics(groupIdOrPath, epicIid, getDefaultPerPage()).all());
479+
}
480+
481+
/**
482+
* Get a Pager of all child epics of an epic and the authenticated user has access to.
483+
*
484+
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/epics</code></pre>
485+
*
486+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
487+
* @param epicIid the IID of the epic to get child epics for
488+
* @param itemsPerPage the number of child epics per page
489+
* @return the Pager of all child epics of the specified epic
490+
* @throws GitLabApiException if any exception occurs
491+
*/
492+
public Pager<ChildEpic> getChildEpics(Object groupIdOrPath, Long epicIid, int itemsPerPage) throws GitLabApiException {
493+
return (new Pager<ChildEpic>(this, ChildEpic.class, itemsPerPage, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "epics"));
494+
}
495+
496+
/**
497+
* Gets all child epics of an epic and the authenticated user has access to as a Stream.
498+
*
499+
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/epics</code></pre>
500+
*
501+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
502+
* @param epicIid the IID of the epic to get child epics for
503+
* @return a Stream of all child epics of the specified epic
504+
* @throws GitLabApiException if any exception occurs
505+
*/
506+
public Stream<ChildEpic> getChildEpicsStream(Object groupIdOrPath, Long epicIid) throws GitLabApiException {
507+
return (getChildEpics(groupIdOrPath, epicIid, getDefaultPerPage()).stream());
508+
}
509+
510+
/**
511+
* Creates an association between two epics, designating one as the parent epic and the other as the child epic. A parent epic can have multiple child epics. If the new child epic already belonged to another epic, it is unassigned from that previous parent.
512+
*
513+
* <pre><code>GitLab Endpoint: POST /groups/:id/epics/:epic_iid/epics/:child_epic_id</code></pre>
514+
*
515+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
516+
* @param epicIid the Epic IID to assign the child epic to
517+
* @param childEpicId the global ID of the child epic. Epic IID can’t be used because they can conflict with epics from other groups.
518+
* @return an ChildEpic instance containing info on the newly assigned child epic
519+
* @throws GitLabApiException if any exception occurs
520+
*/
521+
public ChildEpic assignChildEpic(Object groupIdOrPath, Long epicIid, Long childEpicId) throws GitLabApiException {
522+
Response response = post(Response.Status.CREATED, (Form)null,
523+
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "epics", childEpicId);
524+
return (response.readEntity(ChildEpic.class));
525+
}
526+
527+
/**
528+
* Creates a new epic and associates it with provided parent epic.
529+
*
530+
* <pre><code>GitLab Endpoint: POST /groups/:id/epics/:epic_iid/epics</code></pre>
531+
*
532+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
533+
* @param epicIid the Epic IID to assign the child epic to (of the future parent epic)
534+
* @param title the title of a newly created epic
535+
* @param confidential whether the epic should be confidential (optional)
536+
* @return an ChildEpic instance containing info on the newly created and assigned child epic
537+
* @throws GitLabApiException if any exception occurs
538+
*/
539+
public CreatedChildEpic createAndAssignChildEpic(Object groupIdOrPath, Long epicIid, String title, Boolean confidential) throws GitLabApiException {
540+
Form formData = new GitLabApiForm()
541+
.withParam("title", title, true)
542+
.withParam("confidential", confidential);
543+
Response response = post(Response.Status.CREATED, formData.asMap(),
544+
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "epics");
545+
return (response.readEntity(CreatedChildEpic.class));
546+
}
547+
548+
/**
549+
* Re-order a child epic
550+
*
551+
* <pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid/epics/:child_epic_id</code></pre>
552+
*
553+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
554+
* @param epicIid the Epic IID that the child epic is assigned to
555+
* @param childEpicId the ID of the child epic. Epic IID can’t be used because they can conflict with epics from other groups.
556+
* @param moveBeforeId the ID of a sibling epic that should be placed before the child epic (optional)
557+
* @param moveAfterId the ID of a sibling epic that should be placed after the child epic (optional)
558+
* @return a list of all child epics of the specified epic
559+
* @throws GitLabApiException if any exception occurs
560+
*/
561+
public List<ChildEpic> reOrderChildEpic(Object groupIdOrPath, Long epicIid, Long childEpicId, Long moveBeforeId, Long moveAfterId) throws GitLabApiException {
562+
GitLabApiForm form = new GitLabApiForm()
563+
.withParam("move_before_id", moveBeforeId)
564+
.withParam("move_after_id", moveAfterId);
565+
Response response = put(Response.Status.OK, form.asMap(),
566+
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "epics", childEpicId);
567+
return response.readEntity(new GenericType<List<ChildEpic>>() {});
568+
}
569+
570+
/**
571+
* Unassigns a child epic from a parent epic.
572+
*
573+
* <pre><code>GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid/epics/:child_epic_id</code></pre>
574+
*
575+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
576+
* @param epicIid the Epic IID to remove the child epic from
577+
* @param childEpicId the ID of the child epic. Epic IID can’t be used because they can conflict with epics from other groups.
578+
* @return an ChildEpic instance containing info on the removed child epic
579+
* @throws GitLabApiException if any exception occurs
580+
*/
581+
public ChildEpic unassignChildEpic(Object groupIdOrPath, Long epicIid, Long childEpicId) throws GitLabApiException {
582+
Response response = delete(Response.Status.OK, null,
583+
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "epics", childEpicId);
584+
return (response.readEntity(ChildEpic.class));
585+
}
586+
587+
/**
588+
* Gets all linked epics of an epic filtered according to the user authorizations.
589+
*
590+
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/related_epics</code></pre>
591+
*
592+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
593+
* @param epicIid the IID of the epic to get child epics for
594+
* @return a list of all related epics of the specified epic
595+
* @throws GitLabApiException if any exception occurs
596+
*/
597+
public List<RelatedEpic> getRelatedEpics(Object groupIdOrPath, Long epicIid) throws GitLabApiException {
598+
return (getRelatedEpics(groupIdOrPath, epicIid, getDefaultPerPage()).all());
599+
}
600+
601+
/**
602+
* Get a Pager of all linked epics of an epic filtered according to the user authorizations.
603+
*
604+
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/related_epics</code></pre>
605+
*
606+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
607+
* @param epicIid the IID of the epic to get child epics for
608+
* @param itemsPerPage the number of child epics per page
609+
* @return the Pager of all related epics of the specified epic
610+
* @throws GitLabApiException if any exception occurs
611+
*/
612+
public Pager<RelatedEpic> getRelatedEpics(Object groupIdOrPath, Long epicIid, int itemsPerPage) throws GitLabApiException {
613+
return (new Pager<RelatedEpic>(this, RelatedEpic.class, itemsPerPage, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "related_epics"));
614+
}
615+
616+
/**
617+
* Gets all linked epics of an epic filtered according to the user authorizations to as a Stream.
618+
*
619+
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/related_epics</code></pre>
620+
*
621+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
622+
* @param epicIid the IID of the epic to get child epics for
623+
* @return a Stream of all related epics of the specified epic
624+
* @throws GitLabApiException if any exception occurs
625+
*/
626+
public Stream<RelatedEpic> getRelatedEpicsStream(Object groupIdOrPath, Long epicIid) throws GitLabApiException {
627+
return (getRelatedEpics(groupIdOrPath, epicIid, getDefaultPerPage()).stream());
628+
}
629+
630+
/**
631+
* Create a two-way relation between two epics. The user must have at least the Guest role for both groups.
632+
*
633+
* <pre><code>GitLab Endpoint: POST /groups/:id/epics/:epic_iid/related_epics</code></pre>
634+
*
635+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
636+
* @param epicIid the Epic IID to assign the child epic to
637+
* @param targetGroupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path of the target group’s epic
638+
* @param targetEpicIid the Epic IID of the target group’s epic.
639+
* @param linkType the type of the relation (optional), defaults to {@link LinkType#RELATES_TO}.
640+
* @return an RelatedEpic instance containing info on the newly assigned child epic
641+
* @throws GitLabApiException if any exception occurs
642+
*/
643+
public RelatedEpicLink createRelatedEpicLink(Object groupIdOrPath, Long epicIid, Object targetGroupIdOrPath, Long targetEpicIid, LinkType linkType) throws GitLabApiException {
644+
Form formData = new GitLabApiForm()
645+
.withParam("target_group_id", getGroupIdOrPath(targetGroupIdOrPath), true)
646+
.withParam("target_epic_iid", targetEpicIid, true)
647+
.withParam("link_type", linkType);
648+
Response response = post(Response.Status.CREATED, formData.asMap(),
649+
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "related_epics");
650+
return (response.readEntity(RelatedEpicLink.class));
651+
}
652+
653+
/**
654+
* Delete a two-way relation between two epics. The user must have at least the Guest role for both groups.
655+
*
656+
* <pre><code>GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid/related_epics/:related_epic_link_id</code></pre>
657+
*
658+
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
659+
* @param epicIid the Epic IID to remove the child epic from
660+
* @param relatedEpicLinkId the ID a related epic link.
661+
* @return an RelatedEpicLink instance containing info on the removed related epic
662+
* @throws GitLabApiException if any exception occurs
663+
*/
664+
public RelatedEpicLink deleteRelatedEpicLink(Object groupIdOrPath, Long epicIid, Long relatedEpicLinkId) throws GitLabApiException {
665+
Response response = delete(Response.Status.OK, null,
666+
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "related_epics", relatedEpicLinkId);
667+
return (response.readEntity(RelatedEpicLink.class));
668+
}
669+
461670
}
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
package org.gitlab4j.api.models;
2+
3+
import java.util.Date;
4+
import java.util.List;
5+
import java.util.Map;
6+
7+
import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
8+
import org.gitlab4j.api.utils.JacksonJson;
9+
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+
15+
public class AbstractEpic<E extends AbstractEpic<E>> extends AbstractMinimalEpic<E> {
16+
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+
37+
private Long parentIid;
38+
private String description;
39+
private EpicState state;
40+
private String webUrl;
41+
private References references;
42+
private Author author;
43+
private List<String> labels;
44+
private Date startDate;
45+
private Date dueDate;
46+
private Date endDate;
47+
private Date createdAt;
48+
private Date updatedAt;
49+
private Date closedAt;
50+
private Integer downvotes;
51+
private Integer upvotes;
52+
private String color;
53+
@JsonProperty("_links")
54+
private Map<String, String> links;
55+
56+
public Long getParentIid() {
57+
return parentIid;
58+
}
59+
60+
public void setParentIid(Long parentIid) {
61+
this.parentIid = parentIid;
62+
}
63+
64+
public String getDescription() {
65+
return description;
66+
}
67+
68+
public void setDescription(String description) {
69+
this.description = description;
70+
}
71+
72+
@SuppressWarnings("unchecked")
73+
public E withDescription(String description) {
74+
this.description = description;
75+
return (E) (this);
76+
}
77+
78+
public EpicState getState() {
79+
return state;
80+
}
81+
82+
public void setState(EpicState state) {
83+
this.state = state;
84+
}
85+
86+
public String getWebUrl() {
87+
return webUrl;
88+
}
89+
90+
public void setWebUrl(String webUrl) {
91+
this.webUrl = webUrl;
92+
}
93+
94+
public References getReferences() {
95+
return references;
96+
}
97+
98+
public void setReferences(References references) {
99+
this.references = references;
100+
}
101+
102+
public Author getAuthor() {
103+
return author;
104+
}
105+
106+
public void setAuthor(Author author) {
107+
this.author = author;
108+
}
109+
110+
@SuppressWarnings("unchecked")
111+
public E withAuthor(Author author) {
112+
this.author = author;
113+
return (E) (this);
114+
}
115+
116+
public List<String> getLabels() {
117+
return labels;
118+
}
119+
120+
public void setLabels(List<String> labels) {
121+
this.labels = labels;
122+
}
123+
124+
@SuppressWarnings("unchecked")
125+
public E withLabels(List<String> labels) {
126+
this.labels = labels;
127+
return (E) (this);
128+
}
129+
130+
public Date getStartDate() {
131+
return startDate;
132+
}
133+
134+
public void setStartDate(Date startDate) {
135+
this.startDate = startDate;
136+
}
137+
138+
@SuppressWarnings("unchecked")
139+
public E withStartDate(Date startDate) {
140+
this.startDate = startDate;
141+
return (E) (this);
142+
}
143+
144+
public Date getDueDate() {
145+
return dueDate;
146+
}
147+
148+
public void setDueDate(Date dueDate) {
149+
this.dueDate = dueDate;
150+
}
151+
152+
public Date getEndDate() {
153+
return endDate;
154+
}
155+
156+
public void setEndDate(Date endDate) {
157+
this.endDate = endDate;
158+
}
159+
160+
@SuppressWarnings("unchecked")
161+
public E withEndDate(Date endDate) {
162+
this.endDate = endDate;
163+
return (E) (this);
164+
}
165+
166+
public Date getCreatedAt() {
167+
return createdAt;
168+
}
169+
170+
public void setCreatedAt(Date createdAt) {
171+
this.createdAt = createdAt;
172+
}
173+
174+
public Date getUpdatedAt() {
175+
return updatedAt;
176+
}
177+
178+
public void setUpdatedAt(Date updatedAt) {
179+
this.updatedAt = updatedAt;
180+
}
181+
182+
public Date getClosedAt() {
183+
return closedAt;
184+
}
185+
186+
public void setClosedAt(Date closedAt) {
187+
this.closedAt = closedAt;
188+
}
189+
190+
public Integer getDownvotes() {
191+
return downvotes;
192+
}
193+
194+
public void setDownvotes(Integer downvotes) {
195+
this.downvotes = downvotes;
196+
}
197+
198+
public Integer getUpvotes() {
199+
return upvotes;
200+
}
201+
202+
public void setUpvotes(Integer upvotes) {
203+
this.upvotes = upvotes;
204+
}
205+
206+
public String getColor() {
207+
return color;
208+
}
209+
210+
public void setColor(String color) {
211+
this.color = color;
212+
}
213+
214+
public Map<String, String> getLinks() {
215+
return links;
216+
}
217+
218+
public void setLinks(Map<String, String> links) {
219+
this.links = links;
220+
}
221+
222+
@JsonIgnore
223+
public String getLinkByName(String name) {
224+
if (links == null || links.isEmpty()) {
225+
return (null);
226+
}
227+
228+
return (links.get(name));
229+
}
230+
231+
public String toString() {
232+
return (JacksonJson.toJsonString(this));
233+
}
234+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package org.gitlab4j.api.models;
2+
3+
import org.gitlab4j.api.utils.JacksonJson;
4+
5+
public class AbstractMinimalEpic<E extends AbstractMinimalEpic<E>> {
6+
7+
private Long id;
8+
private Long iid;
9+
private Long groupId;
10+
private Long parentId;
11+
private String title;
12+
private String reference;
13+
14+
public Long getId() {
15+
return id;
16+
}
17+
18+
public void setId(Long id) {
19+
this.id = id;
20+
}
21+
22+
public Long getIid() {
23+
return iid;
24+
}
25+
26+
public void setIid(Long iid) {
27+
this.iid = iid;
28+
}
29+
30+
public Long getGroupId() {
31+
return groupId;
32+
}
33+
34+
public void setGroupId(Long groupId) {
35+
this.groupId = groupId;
36+
}
37+
38+
public Long getParentId() {
39+
return parentId;
40+
}
41+
42+
public void setParentId(Long parentId) {
43+
this.parentId = parentId;
44+
}
45+
46+
public String getTitle() {
47+
return title;
48+
}
49+
50+
public void setTitle(String title) {
51+
this.title = title;
52+
}
53+
54+
@SuppressWarnings("unchecked")
55+
public E withTitle(String title) {
56+
this.title = title;
57+
return (E) (this);
58+
}
59+
60+
public String getReference() {
61+
return reference;
62+
}
63+
64+
public void setReference(String reference) {
65+
this.reference = reference;
66+
}
67+
68+
public String toString() {
69+
return (JacksonJson.toJsonString(this));
70+
}
71+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.gitlab4j.api.models;
2+
3+
import org.gitlab4j.api.utils.JacksonJson;
4+
5+
public class ChildEpic extends AbstractEpic<ChildEpic> {
6+
7+
public String toString() {
8+
return (JacksonJson.toJsonString(this));
9+
}
10+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package org.gitlab4j.api.models;
2+
3+
import org.gitlab4j.api.utils.JacksonJson;
4+
5+
public class CreatedChildEpic extends AbstractMinimalEpic<CreatedChildEpic> {
6+
7+
private Boolean hasChildren;
8+
private Boolean hasIssues;
9+
private String url;
10+
private String relationUrl;
11+
12+
public Boolean getHasChildren() {
13+
return hasChildren;
14+
}
15+
16+
public void setHasChildren(Boolean hasChildren) {
17+
this.hasChildren = hasChildren;
18+
}
19+
20+
public Boolean getHasIssues() {
21+
return hasIssues;
22+
}
23+
24+
public void setHasIssues(Boolean hasIssues) {
25+
this.hasIssues = hasIssues;
26+
}
27+
28+
public String getUrl() {
29+
return url;
30+
}
31+
32+
public void setUrl(String url) {
33+
this.url = url;
34+
}
35+
36+
public String getRelationUrl() {
37+
return relationUrl;
38+
}
39+
40+
public void setRelationUrl(String relationUrl) {
41+
this.relationUrl = relationUrl;
42+
}
43+
44+
public String toString() {
45+
return (JacksonJson.toJsonString(this));
46+
}
47+
}

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

Lines changed: 3 additions & 278 deletions
Original file line numberDiff line numberDiff line change
@@ -1,204 +1,15 @@
11
package org.gitlab4j.api.models;
22

33
import java.util.Date;
4-
import java.util.List;
5-
import java.util.Map;
64

7-
import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
85
import org.gitlab4j.api.utils.JacksonJson;
96

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;
7+
public class Epic extends AbstractEpic<Epic> {
148

15-
public class Epic {
16-
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-
37-
private Long id;
38-
private Long iid;
39-
private Long groupId;
40-
private Long parentId;
41-
private Long parentIid;
42-
private String title;
43-
private String description;
44-
private EpicState state;
45-
private String webUrl;
46-
private String reference;
47-
private References references;
48-
private Author author;
49-
private List<String> labels;
50-
private Date startDate;
519
private Boolean startDateIsFixed;
52-
private Date dueDate;
5310
private Boolean dueDateIsFixed;
5411
private Date dueDateFromInheritedSource;
55-
private Date endDate;
56-
private Date createdAt;
57-
private Date updatedAt;
58-
private Date closedAt;
59-
private Integer downvotes;
60-
private Integer upvotes;
61-
private String color;
6212
private Boolean subscribed;
63-
@JsonProperty("_links")
64-
private Map<String, String> links;
65-
66-
public Long getId() {
67-
return id;
68-
}
69-
70-
public void setId(Long id) {
71-
this.id = id;
72-
}
73-
74-
public Long getIid() {
75-
return iid;
76-
}
77-
78-
public void setIid(Long iid) {
79-
this.iid = iid;
80-
}
81-
82-
public Long getGroupId() {
83-
return groupId;
84-
}
85-
86-
public void setGroupId(Long groupId) {
87-
this.groupId = groupId;
88-
}
89-
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-
106-
public String getTitle() {
107-
return title;
108-
}
109-
110-
public void setTitle(String title) {
111-
this.title = title;
112-
}
113-
114-
public Epic withTitle(String title) {
115-
this.title = title;
116-
return (this);
117-
}
118-
119-
public String getDescription() {
120-
return description;
121-
}
122-
123-
public void setDescription(String description) {
124-
this.description = description;
125-
}
126-
127-
public Epic withDescription(String description) {
128-
this.description = description;
129-
return (this);
130-
}
131-
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-
164-
public Author getAuthor() {
165-
return author;
166-
}
167-
168-
public void setAuthor(Author author) {
169-
this.author = author;
170-
}
171-
172-
public Epic withAuthor(Author author) {
173-
this.author = author;
174-
return (this);
175-
}
176-
177-
public List<String> getLabels() {
178-
return labels;
179-
}
180-
181-
public void setLabels(List<String> labels) {
182-
this.labels = labels;
183-
}
184-
185-
public Epic withLabels(List<String> labels) {
186-
this.labels = labels;
187-
return (this);
188-
}
189-
190-
public Date getStartDate() {
191-
return startDate;
192-
}
193-
194-
public void setStartDate(Date startDate) {
195-
this.startDate = startDate;
196-
}
197-
198-
public Epic withStartDate(Date startDate) {
199-
this.startDate = startDate;
200-
return (this);
201-
}
20213

20314
public Boolean getStartDateIsFixed() {
20415
return startDateIsFixed;
@@ -208,14 +19,6 @@ public void setStartDateIsFixed(Boolean startDateIsFixed) {
20819
this.startDateIsFixed = startDateIsFixed;
20920
}
21021

211-
public Date getDueDate() {
212-
return dueDate;
213-
}
214-
215-
public void setDueDate(Date dueDate) {
216-
this.dueDate = dueDate;
217-
}
218-
21922
public Boolean getDueDateIsFixed() {
22023
return dueDateIsFixed;
22124
}
@@ -232,92 +35,14 @@ public void setDueDateFromInheritedSource(Date dueDateFromInheritedSource) {
23235
this.dueDateFromInheritedSource = dueDateFromInheritedSource;
23336
}
23437

235-
public Date getEndDate() {
236-
return endDate;
237-
}
238-
239-
public void setEndDate(Date endDate) {
240-
this.endDate = endDate;
241-
}
242-
243-
public Epic withEndDate(Date endDate) {
244-
this.endDate = endDate;
245-
return (this);
246-
}
247-
248-
public Date getCreatedAt() {
249-
return createdAt;
250-
}
251-
252-
public void setCreatedAt(Date createdAt) {
253-
this.createdAt = createdAt;
254-
}
255-
256-
public Date getUpdatedAt() {
257-
return updatedAt;
258-
}
259-
260-
public void setUpdatedAt(Date updatedAt) {
261-
this.updatedAt = updatedAt;
262-
}
263-
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() {
38+
public Boolean getSubscribed() {
29739
return subscribed;
29840
}
29941

300-
public void setSubscribed(Boolean subscribed) {
42+
public void setSubscribed(Boolean subscribed) {
30143
this.subscribed = subscribed;
30244
}
30345

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-
32146
public String toString() {
32247
return (JacksonJson.toJsonString(this));
32348
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.gitlab4j.api.models;
2+
3+
import org.gitlab4j.api.utils.JacksonJson;
4+
5+
public class EpicInLink extends AbstractEpic<EpicInLink> {
6+
7+
public String toString() {
8+
return (JacksonJson.toJsonString(this));
9+
}
10+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package org.gitlab4j.api.models;
2+
3+
import java.util.Date;
4+
5+
import org.gitlab4j.api.utils.JacksonJson;
6+
7+
public class RelatedEpic extends AbstractEpic<RelatedEpic> {
8+
9+
private Boolean startDateIsFixed;
10+
private Boolean dueDateIsFixed;
11+
private Date dueDateFromInheritedSource;
12+
private Long relatedEpicLinkId;
13+
private LinkType linkType;
14+
private Date linkCreatedAt;
15+
private Date linkUpdatedAt;
16+
17+
public Boolean getStartDateIsFixed() {
18+
return startDateIsFixed;
19+
}
20+
21+
public void setStartDateIsFixed(Boolean startDateIsFixed) {
22+
this.startDateIsFixed = startDateIsFixed;
23+
}
24+
25+
public Boolean getDueDateIsFixed() {
26+
return dueDateIsFixed;
27+
}
28+
29+
public void setDueDateIsFixed(Boolean dueDateIsFixed) {
30+
this.dueDateIsFixed = dueDateIsFixed;
31+
}
32+
33+
public Date getDueDateFromInheritedSource() {
34+
return dueDateFromInheritedSource;
35+
}
36+
37+
public void setDueDateFromInheritedSource(Date dueDateFromInheritedSource) {
38+
this.dueDateFromInheritedSource = dueDateFromInheritedSource;
39+
}
40+
41+
public Long getRelatedEpicLinkId() {
42+
return relatedEpicLinkId;
43+
}
44+
45+
public void setRelatedEpicLinkId(Long relatedEpicLinkId) {
46+
this.relatedEpicLinkId = relatedEpicLinkId;
47+
}
48+
49+
public LinkType getLinkType() {
50+
return linkType;
51+
}
52+
53+
public void setLinkType(LinkType linkType) {
54+
this.linkType = linkType;
55+
}
56+
57+
public Date getLinkCreatedAt() {
58+
return linkCreatedAt;
59+
}
60+
61+
public void setLinkCreatedAt(Date linkCreatedAt) {
62+
this.linkCreatedAt = linkCreatedAt;
63+
}
64+
65+
public Date getLinkUpdatedAt() {
66+
return linkUpdatedAt;
67+
}
68+
69+
public void setLinkUpdatedAt(Date linkUpdatedAt) {
70+
this.linkUpdatedAt = linkUpdatedAt;
71+
}
72+
73+
public String toString() {
74+
return (JacksonJson.toJsonString(this));
75+
}
76+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package org.gitlab4j.api.models;
2+
3+
import java.util.Date;
4+
5+
import org.gitlab4j.api.utils.JacksonJson;
6+
7+
public class RelatedEpicLink {
8+
9+
private Long id;
10+
private EpicInLink sourceEpic;
11+
private EpicInLink targetEpic;
12+
private LinkType linkType;
13+
private Date createdAt;
14+
private Date updatedAt;
15+
16+
public Long getId() {
17+
return id;
18+
}
19+
20+
public void setId(Long id) {
21+
this.id = id;
22+
}
23+
24+
public EpicInLink getSourceEpic() {
25+
return sourceEpic;
26+
}
27+
28+
public void setSourceEpic(EpicInLink sourceEpic) {
29+
this.sourceEpic = sourceEpic;
30+
}
31+
32+
public EpicInLink getTargetEpic() {
33+
return targetEpic;
34+
}
35+
36+
public void setTargetEpic(EpicInLink targetEpic) {
37+
this.targetEpic = targetEpic;
38+
}
39+
40+
public LinkType getLinkType() {
41+
return linkType;
42+
}
43+
44+
public void setLinkType(LinkType linkType) {
45+
this.linkType = linkType;
46+
}
47+
48+
public Date getCreatedAt() {
49+
return createdAt;
50+
}
51+
52+
public void setCreatedAt(Date createdAt) {
53+
this.createdAt = createdAt;
54+
}
55+
56+
public Date getUpdatedAt() {
57+
return updatedAt;
58+
}
59+
60+
public void setUpdatedAt(Date updatedAt) {
61+
this.updatedAt = updatedAt;
62+
}
63+
64+
public String toString() {
65+
return (JacksonJson.toJsonString(this));
66+
}
67+
}

‎src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@
4545
import org.gitlab4j.api.models.Blame;
4646
import org.gitlab4j.api.models.Board;
4747
import org.gitlab4j.api.models.Branch;
48+
import org.gitlab4j.api.models.ChildEpic;
4849
import org.gitlab4j.api.models.Comment;
4950
import org.gitlab4j.api.models.Commit;
5051
import org.gitlab4j.api.models.CommitPayload;
5152
import org.gitlab4j.api.models.CommitStatus;
5253
import org.gitlab4j.api.models.CompareResults;
5354
import org.gitlab4j.api.models.Contributor;
55+
import org.gitlab4j.api.models.CreatedChildEpic;
5456
import org.gitlab4j.api.models.DeployKey;
5557
import org.gitlab4j.api.models.DeployToken;
5658
import org.gitlab4j.api.models.Deployment;
@@ -93,15 +95,17 @@
9395
import org.gitlab4j.api.models.Pipeline;
9496
import org.gitlab4j.api.models.PipelineSchedule;
9597
import org.gitlab4j.api.models.Project;
96-
import org.gitlab4j.api.models.ProjectGroup;
9798
import org.gitlab4j.api.models.ProjectApprovalsConfig;
9899
import org.gitlab4j.api.models.ProjectFetches;
100+
import org.gitlab4j.api.models.ProjectGroup;
99101
import org.gitlab4j.api.models.ProjectHook;
100102
import org.gitlab4j.api.models.ProjectUser;
101103
import org.gitlab4j.api.models.ProtectedBranch;
102104
import org.gitlab4j.api.models.ProtectedTag;
103105
import org.gitlab4j.api.models.PushRules;
104106
import org.gitlab4j.api.models.RegistryRepository;
107+
import org.gitlab4j.api.models.RelatedEpic;
108+
import org.gitlab4j.api.models.RelatedEpicLink;
105109
import org.gitlab4j.api.models.Release;
106110
import org.gitlab4j.api.models.RemoteMirror;
107111
import org.gitlab4j.api.models.RepositoryFile;
@@ -179,6 +183,18 @@ public void testBranch() throws Exception {
179183
assertTrue(!Branch.isValid(branch));
180184
}
181185

186+
@Test
187+
public void testCreatedChildEpic() throws Exception {
188+
CreatedChildEpic childEpic = unmarshalResource(CreatedChildEpic.class, "created-child-epic.json");
189+
assertTrue(compareJson(childEpic, "created-child-epic.json"));
190+
}
191+
192+
@Test
193+
public void testChildEpic() throws Exception {
194+
ChildEpic childEpic = unmarshalResource(ChildEpic.class, "child-epic.json");
195+
assertTrue(compareJson(childEpic, "child-epic.json"));
196+
}
197+
182198
@Test
183199
public void testCommit() throws Exception {
184200
Commit commit = unmarshalResource(Commit.class, "commit.json");
@@ -539,6 +555,18 @@ public void testRegistryRepositories() throws Exception {
539555
assertTrue(compareJson(repos, "registry-repositories.json"));
540556
}
541557

558+
@Test
559+
public void testRelatedEpicLink() throws Exception {
560+
RelatedEpicLink relatedEpics = unmarshalResource(RelatedEpicLink.class, "related-epic-link.json");
561+
assertTrue(compareJson(relatedEpics, "related-epic-link.json"));
562+
}
563+
564+
@Test
565+
public void testRelatedEpics() throws Exception {
566+
List<RelatedEpic> relatedEpics = unmarshalResourceList(RelatedEpic.class, "related-epics.json");
567+
assertTrue(compareJson(relatedEpics, "related-epics.json"));
568+
}
569+
542570
@Test
543571
public void testReleases() throws Exception {
544572
List<Release> releases = unmarshalResourceList(Release.class, "releases.json");
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"id": 30,
3+
"iid": 5,
4+
"group_id": 7,
5+
"parent_id": 3,
6+
"parent_iid": 8,
7+
"title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
8+
"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+
},
17+
"author":{
18+
"id": 7,
19+
"name": "Pamella Huel",
20+
"username": "arnita",
21+
"state": "active",
22+
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
23+
"web_url": "http://gitlab.example.com/arnita"
24+
},
25+
"start_date": "2018-07-01T00:00:00Z",
26+
"due_date": "2018-07-31T00:00:00Z",
27+
"created_at": "2018-07-17T13:36:22.770Z",
28+
"updated_at": "2018-07-18T12:22:05.239Z",
29+
"closed_at": "2018-08-18T12:22:05.239Z",
30+
"labels": [],
31+
"upvotes": 4,
32+
"downvotes": 0,
33+
"color": "#1068bf",
34+
"_links":{
35+
"self": "http://gitlab.example.com/api/v4/groups/7/epics/5",
36+
"epic_issues": "http://gitlab.example.com/api/v4/groups/7/epics/5/issues",
37+
"group":"http://gitlab.example.com/api/v4/groups/7"
38+
}
39+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"id": 42,
3+
"iid": 3,
4+
"title": "this is a test",
5+
"group_id": 139,
6+
"parent_id": 25,
7+
"has_children": false,
8+
"has_issues": false,
9+
"reference": "&3",
10+
"url": "https://gitlab.example.com/groups/a-group/-/epics/3",
11+
"relation_url": "https://gitlab.example.com/groups/a-group/-/epics/1/links/42"
12+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"id": 1,
3+
"created_at": "2022-01-31T15:10:44.988Z",
4+
"updated_at": "2022-01-31T15:10:44.988Z",
5+
"link_type": "relates_to",
6+
"source_epic": {
7+
"id": 21,
8+
"iid": 1,
9+
"color": "#1068bf",
10+
"group_id": 26,
11+
"title": "Aspernatur recusandae distinctio omnis et qui est iste.",
12+
"description": "some description",
13+
"author": {
14+
"id": 15,
15+
"username": "trina",
16+
"name": "Theresia Robel",
17+
"state": "active",
18+
"avatar_url": "https://www.gravatar.com/avatar/085e28df717e16484cbf6ceca75e9a93?s=80&d=identicon",
19+
"web_url": "http://gitlab.example.com/trina"
20+
},
21+
"state": "opened",
22+
"web_url": "http://gitlab.example.com/groups/flightjs/-/epics/1",
23+
"references": {
24+
"short": "&1",
25+
"relative": "&1",
26+
"full": "flightjs&1"
27+
},
28+
"created_at": "2022-01-31T15:10:44.988Z",
29+
"updated_at": "2022-03-16T09:32:35.712Z",
30+
"labels": [],
31+
"upvotes": 0,
32+
"downvotes": 0,
33+
"_links": {
34+
"self": "http://gitlab.example.com/api/v4/groups/26/epics/1",
35+
"epic_issues": "http://gitlab.example.com/api/v4/groups/26/epics/1/issues",
36+
"group": "http://gitlab.example.com/api/v4/groups/26"
37+
}
38+
},
39+
"target_epic": {
40+
"id": 25,
41+
"iid": 5,
42+
"color": "#1068bf",
43+
"group_id": 26,
44+
"title": "Aut assumenda id nihil distinctio fugiat vel numquam est.",
45+
"description": "some description",
46+
"author": {
47+
"id": 3,
48+
"username": "valerie",
49+
"name": "Erika Wolf",
50+
"state": "active",
51+
"avatar_url": "https://www.gravatar.com/avatar/9ef7666abb101418a4716a8ed4dded80?s=80&d=identicon",
52+
"web_url": "http://gitlab.example.com/valerie"
53+
},
54+
"state": "opened",
55+
"web_url": "http://gitlab.example.com/groups/flightjs/-/epics/5",
56+
"references": {
57+
"short": "&5",
58+
"relative": "&5",
59+
"full": "flightjs&5"
60+
},
61+
"created_at": "2022-01-31T15:10:45.080Z",
62+
"updated_at": "2022-03-16T09:32:35.842Z",
63+
"labels": [],
64+
"upvotes": 0,
65+
"downvotes": 0,
66+
"_links": {
67+
"self": "http://gitlab.example.com/api/v4/groups/26/epics/5",
68+
"epic_issues": "http://gitlab.example.com/api/v4/groups/26/epics/5/issues",
69+
"group": "http://gitlab.example.com/api/v4/groups/26"
70+
}
71+
}
72+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[
2+
{
3+
"id": 30,
4+
"iid": 5,
5+
"group_id": 7,
6+
"parent_id": 3,
7+
"parent_iid": 8,
8+
"title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
9+
"description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
10+
"state": "opened",
11+
"web_url": "http://gitlab.example.com/groups/test/-/epics/5",
12+
"reference": "&5",
13+
"references": {
14+
"short": "&5",
15+
"relative": "&5",
16+
"full": "test&5"
17+
},
18+
"author":{
19+
"id": 7,
20+
"name": "Pamella Huel",
21+
"username": "arnita",
22+
"state": "active",
23+
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
24+
"web_url": "http://gitlab.example.com/arnita"
25+
},
26+
"start_date": "2018-07-01T00:00:00Z",
27+
"start_date_is_fixed": false,
28+
"due_date": "2018-07-31T00:00:00Z",
29+
"due_date_is_fixed": false,
30+
"due_date_from_inherited_source": "2018-07-31T00:00:00Z",
31+
"created_at": "2018-07-17T13:36:22.770Z",
32+
"updated_at": "2018-07-18T12:22:05.239Z",
33+
"closed_at": "2018-08-18T12:22:05.239Z",
34+
"labels": [],
35+
"upvotes": 4,
36+
"downvotes": 0,
37+
"color": "#1068bf",
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+
},
43+
"related_epic_link_id": 1,
44+
"link_type": "relates_to",
45+
"link_created_at": "2022-08-23T13:53:37Z",
46+
"link_updated_at": "2022-08-23T13:53:37Z"
47+
}
48+
]

0 commit comments

Comments
 (0)
Please sign in to comment.