Skip to content

Commit

Permalink
BoardApi fixes and group support (#1221)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmini authored Dec 27, 2024
1 parent 973e294 commit 2ce06ee
Show file tree
Hide file tree
Showing 12 changed files with 685 additions and 23 deletions.
417 changes: 406 additions & 11 deletions gitlab4j-api/src/main/java/org/gitlab4j/api/BoardsApi.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public abstract class AbstractUser<U extends AbstractUser<U>> implements Seriali
private Long id;
private String name;
private String state;
private Boolean locked;
private String username;
private String webUrl;

Expand Down Expand Up @@ -60,6 +61,14 @@ public void setName(String name) {
this.name = name;
}

public Boolean getLocked() {
return locked;
}

public void setLocked(Boolean locked) {
this.locked = locked;
}

public String getState() {
return state;
}
Expand Down
56 changes: 55 additions & 1 deletion gitlab4j-models/src/main/java/org/gitlab4j/api/models/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ public class Board implements Serializable {

private Long id;
private String name;
private Boolean hideBacklogList;
private Boolean hideClosedList;
private Project project;
private Milestone milestone;
private List<BoardList> lists;
private Group group;
private Milestone milestone;
private Assignee assignee;
private List<Label> labels;
private Integer weight;

public Long getId() {
return id;
Expand All @@ -30,6 +36,22 @@ public void setName(String name) {
this.name = name;
}

public Boolean getHideBacklogList() {
return hideBacklogList;
}

public void setHideBacklogList(Boolean hideBacklogList) {
this.hideBacklogList = hideBacklogList;
}

public Boolean getHideClosedList() {
return hideClosedList;
}

public void setHideClosedList(Boolean hideClosedList) {
this.hideClosedList = hideClosedList;
}

public Project getProject() {
return project;
}
Expand All @@ -54,6 +76,38 @@ public void setLists(List<BoardList> lists) {
this.lists = lists;
}

public Group getGroup() {
return group;
}

public void setGroup(Group group) {
this.group = group;
}

public Assignee getAssignee() {
return assignee;
}

public void setAssignee(Assignee assignee) {
this.assignee = assignee;
}

public List<Label> getLabels() {
return labels;
}

public void setLabels(List<Label> labels) {
this.labels = labels;
}

public Integer getWeight() {
return weight;
}

public void setWeight(Integer weight) {
this.weight = weight;
}

@Override
public String toString() {
return (JacksonJson.toJsonString(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ public class BoardList implements Serializable {
private Long id;
private Label label;
private Integer position;
private Assignee assignee;
private Milestone milestone;
private Iteration iteration;
private Integer maxIssueCount;
private Integer maxIssueWeight;
private Integer limitMetric;

public Long getId() {
return id;
Expand All @@ -35,6 +41,54 @@ public void setPosition(Integer position) {
this.position = position;
}

public Assignee getAssignee() {
return assignee;
}

public void setAssignee(Assignee assignee) {
this.assignee = assignee;
}

public Milestone getMilestone() {
return milestone;
}

public void setMilestone(Milestone milestone) {
this.milestone = milestone;
}

public Iteration getIteration() {
return iteration;
}

public void setIteration(Iteration iteration) {
this.iteration = iteration;
}

public Integer getMaxIssueCount() {
return maxIssueCount;
}

public void setMaxIssueCount(Integer maxIssueCount) {
this.maxIssueCount = maxIssueCount;
}

public Integer getMaxIssueWeight() {
return maxIssueWeight;
}

public void setMaxIssueWeight(Integer maxIssueWeight) {
this.maxIssueWeight = maxIssueWeight;
}

public Integer getLimitMetric() {
return limitMetric;
}

public void setLimitMetric(Integer limitMetric) {
this.limitMetric = limitMetric;
}

@Override
public String toString() {
return (JacksonJson.toJsonString(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

public class Iteration implements Serializable {
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -52,8 +53,13 @@ public String toString() {
private IterationState state;
private Date createdAt;
private Date updatedAt;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date startDate;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date dueDate;

private String webUrl;

public Long getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Label implements Serializable {
private String color;
private String description;
private String descriptionHtml;
private String textColor;
private Integer openIssuesCount;
private Integer closedIssuesCount;
private Integer openMergeRequestsCount;
Expand Down Expand Up @@ -77,6 +78,14 @@ public void setDescriptionHtml(String descriptionHtml) {
this.descriptionHtml = descriptionHtml;
}

public String getTextColor() {
return textColor;
}

public void setTextColor(String textColor) {
this.textColor = textColor;
}

public Integer getOpenIssuesCount() {
return openIssuesCount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,17 @@ public void testBlame() throws Exception {
}

@Test
public void testBoard() throws Exception {
public void testProjectBoard() throws Exception {
List<Board> boards = unmarshalResourceList(Board.class, "project-board.json");
assertTrue(compareJson(boards, "project-board.json"));
}

@Test
public void testGroupBoard() throws Exception {
List<Board> boards = unmarshalResourceList(Board.class, "group-board.json");
assertTrue(compareJson(boards, "group-board.json"));
}

@Test
public void testBranch() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"state": 3,
"created_at": "2023-08-07T00:05:06.739Z",
"updated_at": "2023-09-04T00:05:06.612Z",
"start_date": "2023-09-04T00:00:00Z",
"due_date": "2023-09-10T00:00:00Z",
"start_date": "2023-09-04",
"due_date": "2023-09-10",
"web_url": "http://example.com/example/-/iterations/158"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
[
{
"id": 70,
"name": "Development",
"hide_backlog_list": false,
"hide_closed_list": false,
"lists": [],
"group": {
"id": 1474,
"web_url": "https://example.gitlab.com/groups/a-group/main",
"name": "Main"
},
"labels": [],
"weight": 4
},
{
"id": 71,
"name": "uSlots",
"hide_backlog_list": true,
"hide_closed_list": true,
"lists": [
{
"id": 360,
"label": {
"id": 13640,
"name": "a-label",
"description": "desc",
"description_html": "desc",
"text_color": "#FFFFFF",
"color": "#9400d3"
},
"position": 0,
"max_issue_count": 0,
"max_issue_weight": 0
},
{
"id": 361,
"label": {
"id": 13641,
"name": "b-label",
"description": "desc2",
"description_html": "desc2",
"text_color": "#FFFFFF",
"color": "#9400d3"
},
"position": 1,
"max_issue_count": 0,
"max_issue_weight": 0
},
{
"id": 362,
"position": 2,
"assignee": {
"id": 61,
"username": "john.smith",
"name": "John Smith"
},
"max_issue_count": 0,
"max_issue_weight": 0
},
{
"id": 363,
"position": 3,
"assignee": {
"id": 26,
"username": "alice.johnson",
"name": "Alice Johnson"
},
"max_issue_count": 0,
"max_issue_weight": 0
}
],
"group": {
"id": 1474,
"web_url": "https://example.gitlab.com/groups/a-group/main",
"name": "Main"
},
"milestone": {
"title": "Started"
},
"assignee": {
"id": 37,
"username": "bob.martin",
"name": "Bob Martin",
"state": "active",
"locked": false,
"avatar_url": "https://example.gitlab.com/uploads/-/system/user/avatar/37/avatar.png",
"web_url": "https://example.gitlab.com/bob.martin"
},
"labels": [
{
"id": 116,
"name": "Abc",
"description": "",
"description_html": "",
"text_color": "#FFFFFF",
"color": "#6699cc"
}
],
"weight": 3
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
"state": 1,
"created_at": "2023-08-07T00:05:06.739Z",
"updated_at": "2023-09-04T00:05:06.612Z",
"start_date": "2023-09-04T00:00:00Z",
"due_date": "2023-09-10T00:00:00Z",
"start_date": "2023-09-04",
"due_date": "2023-09-10",
"web_url": "http://example.com/example/-/iterations/158"
},
"health_status": "needs_attention"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"state": 2,
"created_at": "2022-03-14T05:21:11.929Z",
"updated_at": "2022-03-14T05:21:11.929Z",
"start_date": "2022-03-08T00:00:00Z",
"due_date": "2022-03-14T00:00:00Z",
"start_date": "2022-03-08",
"due_date": "2022-03-14",
"web_url": "https://gitlab.com/groups/my-group/-/iterations/90"
}
Loading

0 comments on commit 2ce06ee

Please sign in to comment.