Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
d1f22d8c
Commit
d1f22d8c
authored
Mar 08, 2020
by
Greg Messner
Browse files
Added support for external issue IDs (#528)
parent
67218105
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/models/Issue.java
View file @
d1f22d8c
...
...
@@ -7,6 +7,12 @@ import java.util.List;
import
org.gitlab4j.api.Constants.IssueState
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.databind.node.IntNode
;
import
com.fasterxml.jackson.databind.node.TextNode
;
import
com.fasterxml.jackson.databind.node.ValueNode
;
public
class
Issue
{
public
static
class
TaskCompletionStatus
{
...
...
@@ -46,7 +52,14 @@ public class Issue {
private
User
closedBy
;
private
String
description
;
private
Date
dueDate
;
@JsonProperty
(
"id"
)
private
ValueNode
actualId
;
@JsonIgnore
private
String
externalId
;
@JsonIgnore
private
Integer
id
;
private
Integer
iid
;
private
Integer
issueLinkId
;
private
List
<
String
>
labels
;
...
...
@@ -121,15 +134,44 @@ public class Issue {
}
public
void
setDueDate
(
Date
dueDate
)
{
this
.
dueDate
=
dueDate
;
this
.
dueDate
=
dueDate
;
}
public
ValueNode
getActualId
()
{
return
actualId
;
}
public
void
setActualId
(
ValueNode
id
)
{
actualId
=
id
;
if
(
actualId
instanceof
TextNode
)
{
externalId
=
actualId
.
asText
();
}
else
if
(
actualId
instanceof
IntNode
)
{
this
.
id
=
actualId
.
asInt
();
}
}
public
Integer
getId
()
{
return
id
;
return
(
id
)
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
if
(
id
!=
null
)
{
actualId
=
new
IntNode
(
id
);
externalId
=
null
;
}
}
public
String
getExternalId
()
{
return
(
externalId
);
}
public
void
setExternalId
(
String
externalId
)
{
this
.
externalId
=
externalId
;
if
(
externalId
!=
null
)
{
actualId
=
new
TextNode
(
externalId
);
id
=
null
;
}
}
public
Integer
getIid
()
{
...
...
src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java
View file @
d1f22d8c
...
...
@@ -296,6 +296,12 @@ public class TestGitLabApiBeans {
assertTrue
(
compareJson
(
issueLink
,
"issue-link.json"
));
}
@Test
public
void
testIssuesClosedBy
()
throws
Exception
{
List
<
Issue
>
issues
=
unmarshalResourceList
(
Issue
.
class
,
"issues-closed-by-mr.json"
);
assertTrue
(
compareJson
(
issues
,
"issues-closed-by-mr.json"
));
}
@Test
public
void
testLabelEvents
()
throws
Exception
{
List
<
LabelEvent
>
events
=
unmarshalResourceList
(
LabelEvent
.
class
,
"label-events.json"
);
...
...
src/test/resources/org/gitlab4j/api/issues-closed-by-mr.json
0 → 100644
View file @
d1f22d8c
[
{
"state"
:
"opened"
,
"description"
:
"Ratione dolores corrupti mollitia soluta quia."
,
"author"
:
{
"state"
:
"active"
,
"id"
:
18
,
"web_url"
:
"https://gitlab.example.com/eileen.lowe"
,
"name"
:
"Alexandra Bashirian"
,
"username"
:
"eileen.lowe"
},
"milestone"
:
{
"project_id"
:
1
,
"description"
:
"Ducimus nam enim ex consequatur cumque ratione."
,
"state"
:
"closed"
,
"iid"
:
2
,
"created_at"
:
"2016-01-04T15:31:39.996Z"
,
"title"
:
"v4.0"
,
"id"
:
17
,
"updated_at"
:
"2016-01-04T15:31:39.996Z"
},
"project_id"
:
1
,
"assignee"
:
{
"state"
:
"active"
,
"id"
:
1
,
"name"
:
"Administrator"
,
"web_url"
:
"https://gitlab.example.com/root"
,
"username"
:
"root"
},
"updated_at"
:
"2016-01-04T15:31:51.081Z"
,
"id"
:
76
,
"title"
:
"Consequatur vero maxime deserunt laboriosam est voluptas dolorem."
,
"created_at"
:
"2016-01-04T15:31:51.081Z"
,
"iid"
:
6
,
"labels"
:
[],
"user_notes_count"
:
1
},
{
"id"
:
"PROJECT-123"
,
"title"
:
"Title of this Jira issue"
}
]
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment