Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
4769949a
Commit
4769949a
authored
Jul 28, 2017
by
Mustafa YILDIRIM
Committed by
Tim Olshansky
Jul 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add jira service (#220)
parent
90c9f2ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
231 additions
and
0 deletions
+231
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+59
-0
GitlabJiraProperties.java
...main/java/org/gitlab/api/models/GitlabJiraProperties.java
+48
-0
GitlabServiceJira.java
src/main/java/org/gitlab/api/models/GitlabServiceJira.java
+124
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
4769949a
...
@@ -2771,6 +2771,65 @@ public class GitlabAPI {
...
@@ -2771,6 +2771,65 @@ public class GitlabAPI {
return
retrieve
().
method
(
"PUT"
).
to
(
tailUrl
,
Boolean
.
class
);
return
retrieve
().
method
(
"PUT"
).
to
(
tailUrl
,
Boolean
.
class
);
}
}
/**
* Get JIRA service settings for a project.
* https://docs.gitlab.com/ce/api/services.html#get-jira-service-settings
*
* @param projectId The ID of the project containing the variable.
* @return
* @throws IOException
*/
public
GitlabServiceJira
getJiraService
(
Integer
projectId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
projectId
+
GitlabServiceJira
.
URL
;
return
retrieve
().
to
(
tailUrl
,
GitlabServiceJira
.
class
);
}
/**
* Remove all previously JIRA settings from a project.
* https://docs.gitlab.com/ce/api/services.html#delete-jira-service
*
* @param projectId The ID of the project containing the variable.
* @return
* @throws IOException
*/
public
boolean
deleteJiraService
(
Integer
projectId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
projectId
+
GitlabServiceJira
.
URL
;
return
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Boolean
.
class
);
}
/**
* Set JIRA service for a project.
* https://docs.gitlab.com/ce/api/services.html#create-edit-jira-service
*
* @param projectId The ID of the project containing the variable.
* @param jiraPropties
* @return
* @throws IOException
*/
public
boolean
createOrEditJiraService
(
Integer
projectId
,
GitlabJiraProperties
jiraPropties
)
throws
IOException
{
Query
query
=
new
Query
()
.
appendIf
(
"url"
,
jiraPropties
.
getUrl
())
.
appendIf
(
"project_key"
,
jiraPropties
.
getProjectKey
());
if
(!
jiraPropties
.
getUsername
().
isEmpty
()){
query
.
appendIf
(
"username"
,
jiraPropties
.
getUsername
());
}
if
(!
jiraPropties
.
getPassword
().
isEmpty
()){
query
.
appendIf
(
"password"
,
jiraPropties
.
getPassword
());
}
if
(
jiraPropties
.
getIssueTransitionId
()
!=
null
){
query
.
appendIf
(
"jira_issue_transition_id"
,
jiraPropties
.
getIssueTransitionId
());
}
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
projectId
+
GitlabServiceJira
.
URL
+
query
.
toString
();
return
retrieve
().
method
(
"PUT"
).
to
(
tailUrl
,
Boolean
.
class
);
}
/**
/**
*
*
* Get a list of projects accessible by the authenticated user by search.
* Get a list of projects accessible by the authenticated user by search.
...
...
src/main/java/org/gitlab/api/models/GitlabJiraProperties.java
0 → 100644
View file @
4769949a
package
org
.
gitlab
.
api
.
models
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabJiraProperties
{
private
String
url
;
@JsonProperty
(
"project_key"
)
private
String
projectKey
;
private
String
username
;
private
String
password
;
@JsonProperty
(
"jira_issue_transition_id"
)
private
Integer
issueTransitionId
;
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getProjectKey
()
{
return
projectKey
;
}
public
void
setProjectKey
(
String
projectKey
)
{
this
.
projectKey
=
projectKey
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
Integer
getIssueTransitionId
()
{
return
issueTransitionId
;
}
public
void
setIssueTransitionId
(
Integer
issueTransitionId
)
{
this
.
issueTransitionId
=
issueTransitionId
;
}
}
src/main/java/org/gitlab/api/models/GitlabServiceJira.java
0 → 100644
View file @
4769949a
package
org
.
gitlab
.
api
.
models
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabServiceJira
{
public
static
final
String
URL
=
"/services/jira/"
;
private
Integer
id
;
private
String
title
;
@JsonProperty
(
"created_at"
)
private
Date
createdAt
;
@JsonProperty
(
"updated_at"
)
private
Date
updatedAt
;
private
boolean
active
;
private
boolean
push_events
;
private
boolean
issues_events
;
private
boolean
merge_requests_events
;
private
boolean
tag_push_events
;
private
boolean
note_events
;
private
boolean
build_events
;
private
GitlabJiraProperties
properties
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
Date
getUpdatedAt
()
{
return
updatedAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
boolean
isActive
()
{
return
active
;
}
public
void
setActive
(
boolean
active
)
{
this
.
active
=
active
;
}
public
boolean
isPushEvents
()
{
return
push_events
;
}
public
void
setPushEvents
(
boolean
push_events
)
{
this
.
push_events
=
push_events
;
}
public
boolean
isIssuesEvents
()
{
return
issues_events
;
}
public
void
setIssuesEvents
(
boolean
issues_events
)
{
this
.
issues_events
=
issues_events
;
}
public
boolean
isMergeRequestsEvents
()
{
return
merge_requests_events
;
}
public
void
setMergeRequestsEvents
(
boolean
merge_requests_events
)
{
this
.
merge_requests_events
=
merge_requests_events
;
}
public
boolean
isTagPushEvents
()
{
return
tag_push_events
;
}
public
void
setTagPushEvents
(
boolean
tag_push_events
)
{
this
.
tag_push_events
=
tag_push_events
;
}
public
boolean
isNoteEvents
()
{
return
note_events
;
}
public
void
setNoteEvents
(
boolean
note_events
)
{
this
.
note_events
=
note_events
;
}
public
boolean
isBuildEvents
()
{
return
build_events
;
}
public
void
setBuildEvents
(
boolean
build_events
)
{
this
.
build_events
=
build_events
;
}
public
GitlabJiraProperties
getProperties
()
{
return
properties
;
}
public
void
setProperties
(
GitlabJiraProperties
properties
)
{
this
.
properties
=
properties
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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