forked from gitlab4j/gitlab4j-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmailOnPushService.java
95 lines (74 loc) · 3.17 KB
/
EmailOnPushService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package org.gitlab4j.api.services;
import org.gitlab4j.models.GitLabForm;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class EmailOnPushService extends NotificationService {
private static final long serialVersionUID = 1L;
public static final String RECIPIENT_PROP = "recipients";
public static final String DISABLE_DIFFS_PROP = "disable_diffs";
public static final String SEND_FROM_COMMITTER_EMAIL_PROP = "send_from_committer_email";
@Override
public GitLabForm servicePropertiesForm() {
GitLabForm formData = new GitLabForm()
.withParam(RECIPIENT_PROP, getRecipients(), true)
.withParam(DISABLE_DIFFS_PROP, getDisableDiffs())
.withParam(SEND_FROM_COMMITTER_EMAIL_PROP, getSendFromCommitterEmail())
.withParam(PUSH_EVENTS_PROP, getPushEvents())
.withParam("tag_push_events", getTagPushEvents())
.withParam(BRANCHES_TO_BE_NOTIFIED_PROP, getBranchesToBeNotified());
return formData;
}
public EmailOnPushService withPushEvents(Boolean pushEvents) {
return withPushEvents(pushEvents, this);
}
public EmailOnPushService withTagPushEvents(Boolean pushEvents) {
return withTagPushEvents(pushEvents, this);
}
@JsonIgnore
public String getRecipients() {
return (getProperty(RECIPIENT_PROP));
}
public void setRecipients(String recipients) {
setProperty(RECIPIENT_PROP, recipients);
}
public EmailOnPushService withRecipients(String recipients) {
setRecipients(recipients);
return this;
}
@JsonIgnore
public Boolean getDisableDiffs() {
return Boolean.valueOf(getProperty(DISABLE_DIFFS_PROP, false));
}
public void setDisableDiffs(Boolean disableDiffs) {
setProperty(DISABLE_DIFFS_PROP, disableDiffs);
}
public EmailOnPushService withDisableDiffs(Boolean disableDiffs) {
setDisableDiffs(disableDiffs);
return this;
}
@JsonIgnore
public Boolean getSendFromCommitterEmail() {
return Boolean.valueOf(getProperty(SEND_FROM_COMMITTER_EMAIL_PROP, false));
}
public void setSendFromCommitterEmail(Boolean sendFromCommitterEmail) {
setProperty(SEND_FROM_COMMITTER_EMAIL_PROP, sendFromCommitterEmail);
}
public EmailOnPushService withSendFromCommitterEmail(Boolean sendFromCommitterEmail) {
setSendFromCommitterEmail(sendFromCommitterEmail);
return this;
}
@JsonIgnore
public BranchesToBeNotified getBranchesToBeNotified() {
String branchesToBeNotified = getProperty(BRANCHES_TO_BE_NOTIFIED_PROP);
if (branchesToBeNotified == null || branchesToBeNotified.isEmpty()) {
return null;
}
return (BranchesToBeNotified.valueOf(branchesToBeNotified.toUpperCase()));
}
public void setBranchesToBeNotified(BranchesToBeNotified branchesToBeNotified) {
setProperty(BRANCHES_TO_BE_NOTIFIED_PROP, branchesToBeNotified.toString());
}
public EmailOnPushService withBranchesToBeNotified(BranchesToBeNotified branchesToBeNotified) {
setBranchesToBeNotified(branchesToBeNotified);
return this;
}
}