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
70ab67b1
Commit
70ab67b1
authored
Jul 09, 2019
by
Greg Messner
Browse files
Mods to move property setting into service class.
parent
c84bea9f
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/services/ExternalWikiService.java
View file @
70ab67b1
package
org.gitlab4j.api.services
;
package
org.gitlab4j.api.services
;
import
org.gitlab4j.api.GitLabApiForm
;
public
class
ExternalWikiService
extends
NotificationService
{
public
class
ExternalWikiService
extends
NotificationService
{
public
static
final
String
WIKIURL_KEY_PROP
=
"external_wiki_url"
;
public
static
final
String
WIKIURL_KEY_PROP
=
"external_wiki_url"
;
/**
* Get the form data for this service based on it's properties.
*
* @return the form data for this service based on it's properties
*/
@Override
public
GitLabApiForm
servicePropertiesForm
()
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"external_wiki_url"
,
getExternalWikiUrl
(),
true
);
return
formData
;
}
public
String
getExternalWikiUrl
()
{
public
String
getExternalWikiUrl
()
{
return
this
.
getProperty
(
WIKIURL_KEY_PROP
);
return
this
.
getProperty
(
WIKIURL_KEY_PROP
);
}
}
...
...
src/main/java/org/gitlab4j/api/services/HipChatService.java
View file @
70ab67b1
package
org.gitlab4j.api.services
;
package
org.gitlab4j.api.services
;
import
org.gitlab4j.api.GitLabApiForm
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
public
class
HipChatService
extends
NotificationService
{
public
class
HipChatService
extends
NotificationService
{
...
@@ -11,7 +13,32 @@ public class HipChatService extends NotificationService {
...
@@ -11,7 +13,32 @@ public class HipChatService extends NotificationService {
public
static
final
String
API_VERSION_PROP
=
"api_version"
;
public
static
final
String
API_VERSION_PROP
=
"api_version"
;
public
static
final
String
SERVER_PROP
=
"server"
;
public
static
final
String
SERVER_PROP
=
"server"
;
public
static
final
String
NOTIFY_ONLY_BROKEN_PIPELINES_PROP
=
"notify_only_broken_pipelines"
;
public
static
final
String
NOTIFY_ONLY_BROKEN_PIPELINES_PROP
=
"notify_only_broken_pipelines"
;
/**
* Get the form data for this service based on it's properties.
*
* @return the form data for this service based on it's properties
*/
@Override
public
GitLabApiForm
servicePropertiesForm
()
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"push_events"
,
getPushEvents
())
.
withParam
(
"issues_events"
,
getIssuesEvents
())
.
withParam
(
"confidential_issues_events"
,
getConfidentialIssuesEvents
())
.
withParam
(
"merge_requests_events"
,
getMergeRequestsEvents
())
.
withParam
(
"tag_push_events"
,
getTagPushEvents
())
.
withParam
(
"note_events"
,
getNoteEvents
())
.
withParam
(
"confidential_note_events"
,
getConfidentialNoteEvents
())
.
withParam
(
"pipeline_events"
,
getPipelineEvents
())
.
withParam
(
"token"
,
getToken
(),
true
)
.
withParam
(
"color"
,
getColor
())
.
withParam
(
"notify"
,
getNotify
())
.
withParam
(
"room"
,
getRoom
())
.
withParam
(
"api_version"
,
getApiVersion
())
.
withParam
(
"server"
,
getServer
())
.
withParam
(
"notify_only_broken_pipelines"
,
getNotifyOnlyBrokenPipelines
());
return
formData
;
}
public
HipChatService
withPushEvents
(
Boolean
pushEvents
)
{
public
HipChatService
withPushEvents
(
Boolean
pushEvents
)
{
return
withPushEvents
(
pushEvents
,
this
);
return
withPushEvents
(
pushEvents
,
this
);
...
...
src/main/java/org/gitlab4j/api/services/JiraService.java
View file @
70ab67b1
...
@@ -2,6 +2,8 @@ package org.gitlab4j.api.services;
...
@@ -2,6 +2,8 @@ package org.gitlab4j.api.services;
import
java.util.Map
;
import
java.util.Map
;
import
org.gitlab4j.api.GitLabApiForm
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
public
class
JiraService
extends
NotificationService
{
public
class
JiraService
extends
NotificationService
{
...
@@ -14,6 +16,25 @@ public class JiraService extends NotificationService {
...
@@ -14,6 +16,25 @@ public class JiraService extends NotificationService {
private
CharSequence
password
;
private
CharSequence
password
;
/**
* Get the form data for this service based on it's properties.
*
* @return the form data for this service based on it's properties
*/
@Override
public
GitLabApiForm
servicePropertiesForm
()
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"merge_requests_events"
,
getMergeRequestsEvents
())
.
withParam
(
"commit_events"
,
getCommitEvents
())
.
withParam
(
"url"
,
getUrl
(),
true
)
.
withParam
(
"api_url"
,
getApiUrl
())
.
withParam
(
"project_key"
,
getProjectKey
())
.
withParam
(
"username"
,
getUsername
(),
true
)
.
withParam
(
"password"
,
getPassword
(),
true
)
.
withParam
(
"jira_issue_transition_id"
,
getJiraIssueTransitionId
());
return
formData
;
}
public
JiraService
withCommitEvents
(
Boolean
commitEvents
)
{
public
JiraService
withCommitEvents
(
Boolean
commitEvents
)
{
return
withCommitEvents
(
commitEvents
,
this
);
return
withCommitEvents
(
commitEvents
,
this
);
}
}
...
...
src/main/java/org/gitlab4j/api/services/MattermostService.java
View file @
70ab67b1
package
org.gitlab4j.api.services
;
package
org.gitlab4j.api.services
;
import
org.gitlab4j.api.GitLabApiForm
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
public
class
MattermostService
extends
NotificationService
{
public
class
MattermostService
extends
NotificationService
{
private
String
defaultChannel
;
private
String
defaultChannel
;
/**
* Get the form data for this service based on it's properties.
*
* @return the form data for this service based on it's properties
*/
@Override
public
GitLabApiForm
servicePropertiesForm
()
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"webhook"
,
getWebhook
(),
true
)
.
withParam
(
"username"
,
getUsername
())
.
withParam
(
"channel"
,
getDefaultChannel
())
.
withParam
(
"notify_only_broken_pipelines"
,
getNotifyOnlyBrokenPipelines
())
.
withParam
(
"notify_only_default_branch"
,
getNotifyOnlyDefaultBranch
())
.
withParam
(
"push_events"
,
getPushEvents
())
.
withParam
(
"issues_events"
,
getIssuesEvents
())
.
withParam
(
"confidential_issues_events"
,
getConfidentialIssuesEvents
())
.
withParam
(
"merge_requests_events"
,
getMergeRequestsEvents
())
.
withParam
(
"tag_push_events"
,
getTagPushEvents
())
.
withParam
(
"note_events"
,
getNoteEvents
())
.
withParam
(
"confidential_note_events"
,
getConfidentialNoteEvents
())
.
withParam
(
"pipeline_events"
,
getPipelineEvents
())
.
withParam
(
"wiki_page_events"
,
getWikiPageEvents
())
.
withParam
(
"push_channel"
,
getPushChannel
())
.
withParam
(
"issue_channel"
,
getIssueChannel
())
.
withParam
(
"confidential_issue_channel"
,
getConfidentialIssueChannel
())
.
withParam
(
"merge_request_channel"
,
getMergeRequestChannel
())
.
withParam
(
"note_channel"
,
getNoteChannel
())
.
withParam
(
"confidential_note_channel"
,
getConfidentialNoteChannel
())
.
withParam
(
"tag_push_channel"
,
getTagPushChannel
())
.
withParam
(
"pipeline_channel"
,
getPipelineChannel
())
.
withParam
(
"wiki_page_channel"
,
getWikiPageChannel
());
return
formData
;
}
public
MattermostService
withPushEvents
(
Boolean
pushEvents
)
{
public
MattermostService
withPushEvents
(
Boolean
pushEvents
)
{
return
withPushEvents
(
pushEvents
,
this
);
return
withPushEvents
(
pushEvents
,
this
);
}
}
...
...
src/main/java/org/gitlab4j/api/services/NotificationService.java
View file @
70ab67b1
...
@@ -4,12 +4,12 @@ import java.util.Date;
...
@@ -4,12 +4,12 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
org.gitlab4j.api.GitLabApiForm
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
public
abstract
class
NotificationService
{
public
abstract
class
NotificationService
{
public
static
final
String
WEBHOOK_PROP
=
"webhook"
;
public
static
final
String
USERNAME_PROP
=
"username"
;
public
static
final
String
NOTIFY_ONLY_BROKEN_PIPELINES_PROP
=
"notify_only_broken_pipelines"
;
public
static
final
String
NOTIFY_ONLY_BROKEN_PIPELINES_PROP
=
"notify_only_broken_pipelines"
;
public
static
final
String
NOTIFY_ONLY_DEFAULT_BRANCH_PROP
=
"notify_only_default_branch"
;
public
static
final
String
NOTIFY_ONLY_DEFAULT_BRANCH_PROP
=
"notify_only_default_branch"
;
public
static
final
String
PUSH_CHANNEL_PROP
=
"push_channel"
;
public
static
final
String
PUSH_CHANNEL_PROP
=
"push_channel"
;
...
@@ -22,6 +22,15 @@ public abstract class NotificationService {
...
@@ -22,6 +22,15 @@ public abstract class NotificationService {
public
static
final
String
PIPELINE_CHANNEL_PROP
=
"pipeline_channel"
;
public
static
final
String
PIPELINE_CHANNEL_PROP
=
"pipeline_channel"
;
public
static
final
String
WIKI_PAGE_CHANNEL_PROP
=
"wiki_page_channel"
;
public
static
final
String
WIKI_PAGE_CHANNEL_PROP
=
"wiki_page_channel"
;
public
static
final
String
WEBHOOK_PROP
=
"webhook"
;
public
static
final
String
USERNAME_PROP
=
"username"
;
public
static
final
String
DESCRIPTION_PROP
=
"description"
;
public
static
final
String
TITLE_PROP
=
"title"
;
public
static
final
String
NEW_ISSUE_URL_PROP
=
"new_issue_url"
;
public
static
final
String
ISSUES_URL_PROP
=
"issues_url"
;
public
static
final
String
PROJECT_URL_PROP
=
"project_url"
;
public
static
final
String
PUSH_EVENTS_PROP
=
"push_events"
;
private
Integer
id
;
private
Integer
id
;
private
String
title
;
private
String
title
;
private
Date
createdAt
;
private
Date
createdAt
;
...
@@ -42,6 +51,8 @@ public abstract class NotificationService {
...
@@ -42,6 +51,8 @@ public abstract class NotificationService {
private
Map
<
String
,
Object
>
properties
;
private
Map
<
String
,
Object
>
properties
;
public
abstract
GitLabApiForm
servicePropertiesForm
();
public
Integer
getId
()
{
public
Integer
getId
()
{
return
id
;
return
id
;
}
}
...
...
src/main/java/org/gitlab4j/api/services/SlackService.java
View file @
70ab67b1
package
org.gitlab4j.api.services
;
package
org.gitlab4j.api.services
;
import
org.gitlab4j.api.GitLabApiForm
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
public
class
SlackService
extends
NotificationService
{
public
class
SlackService
extends
NotificationService
{
private
String
defaultChannel
;
private
String
defaultChannel
;
/**
* Get the form data for this service based on it's properties.
*
* @return the form data for this service based on it's properties
*/
@Override
public
GitLabApiForm
servicePropertiesForm
()
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"webhook"
,
getWebhook
(),
true
)
.
withParam
(
"username"
,
getUsername
())
.
withParam
(
"channel"
,
getDefaultChannel
())
.
withParam
(
"notify_only_broken_pipelines"
,
getNotifyOnlyBrokenPipelines
())
.
withParam
(
"notify_only_default_branch"
,
getNotifyOnlyDefaultBranch
())
.
withParam
(
"push_events"
,
getPushEvents
())
.
withParam
(
"issues_events"
,
getIssuesEvents
())
.
withParam
(
"confidential_issues_events"
,
getConfidentialIssuesEvents
())
.
withParam
(
"merge_requests_events"
,
getMergeRequestsEvents
())
.
withParam
(
"tag_push_events"
,
getTagPushEvents
())
.
withParam
(
"note_events"
,
getNoteEvents
())
.
withParam
(
"confidential_note_events"
,
getConfidentialNoteEvents
())
.
withParam
(
"pipeline_events"
,
getPipelineEvents
())
.
withParam
(
"wiki_page_events"
,
getWikiPageEvents
())
.
withParam
(
"push_channel"
,
getPushChannel
())
.
withParam
(
"issue_channel"
,
getIssueChannel
())
.
withParam
(
"confidential_issue_channel"
,
getConfidentialIssueChannel
())
.
withParam
(
"merge_request_channel"
,
getMergeRequestChannel
())
.
withParam
(
"note_channel"
,
getNoteChannel
())
.
withParam
(
"confidential_note_channel"
,
getConfidentialNoteChannel
())
.
withParam
(
"tag_push_channel"
,
getTagPushChannel
())
.
withParam
(
"pipeline_channel"
,
getPipelineChannel
())
.
withParam
(
"wiki_page_channel"
,
getWikiPageChannel
());
return
formData
;
}
public
SlackService
withPushEvents
(
Boolean
pushEvents
)
{
public
SlackService
withPushEvents
(
Boolean
pushEvents
)
{
return
withPushEvents
(
pushEvents
,
this
);
return
withPushEvents
(
pushEvents
,
this
);
}
}
...
...
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