Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/main/java/org/gitlab4j/api/services/EmailOnPushService.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public EmailOnPushService withTagPushEvents(Boolean pushEvents) {

@JsonIgnore
public String getRecipients() {
return ((String)getProperty(RECIPIENT_PROP));
return (getProperty(RECIPIENT_PROP));
}
public void setRecipients(String recipients) {
setProperty(RECIPIENT_PROP, recipients);
Expand All @@ -45,7 +45,7 @@ public EmailOnPushService withRecipients(String recipients) {

@JsonIgnore
public Boolean getDisableDiffs() {
return Boolean.valueOf(getProperty(DISABLE_DIFFS_PROP,"false"));
return Boolean.valueOf(getProperty(DISABLE_DIFFS_PROP, false));
}
public void setDisableDiffs(Boolean disableDiffs) {
setProperty(DISABLE_DIFFS_PROP, disableDiffs);
Expand All @@ -54,10 +54,10 @@ public EmailOnPushService withDisableDiffs(Boolean disableDiffs) {
setDisableDiffs(disableDiffs);
return this;
}

@JsonIgnore
public Boolean getSendFromCommitterEmail() {
return Boolean.valueOf(getProperty(SEND_FROM_COMMITTER_EMAIL_PROP,"false"));
return Boolean.valueOf(getProperty(SEND_FROM_COMMITTER_EMAIL_PROP, false));
}
public void setSendFromCommitterEmail(Boolean sendFromCommitterEmail) {
setProperty(SEND_FROM_COMMITTER_EMAIL_PROP, sendFromCommitterEmail);
Expand All @@ -68,16 +68,20 @@ public EmailOnPushService withSendFromCommitterEmail(Boolean sendFromCommitterEm
}

@JsonIgnore
public String getBranchesToBeNotified() {
return ((String)getProperty(BRANCHES_TO_BE_NOTIFIED_PROP));
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(String branchesToBeNotified) {
setProperty(BRANCHES_TO_BE_NOTIFIED_PROP, branchesToBeNotified);
public void setBranchesToBeNotified(BranchesToBeNotified branchesToBeNotified) {
setProperty(BRANCHES_TO_BE_NOTIFIED_PROP, branchesToBeNotified.toString());
}
public EmailOnPushService withBranchesToBeNotified(String branchesToBeNotified) {
public EmailOnPushService withBranchesToBeNotified(BranchesToBeNotified branchesToBeNotified) {
setBranchesToBeNotified(branchesToBeNotified);
return this;
}


}
34 changes: 33 additions & 1 deletion src/main/java/org/gitlab4j/api/services/NotificationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ public abstract class NotificationService {

private Integer id;
private String title;
private String slug;
private Date createdAt;
private Date updatedAt;
private Boolean active;

private Boolean commitEvents;
private Boolean pushEvents;
private Boolean issuesEvents;
private Boolean confidentialIssuesEvents;
Expand All @@ -61,6 +63,14 @@ public void setId(Integer id) {
this.id = id;
}

public String getSlug() {
return slug;
}

public void setSlug(String slug) {
this.slug = slug;
}

public String getTitle() {
return title;
}
Expand Down Expand Up @@ -97,6 +107,19 @@ public void setActive(Boolean active) {
// The following methods can be used to configure the notification service
// *******************************************************************************

public Boolean getCommitEvents() {
return commitEvents;
}

public void setCommitEvents(Boolean commitEvents) {
this.commitEvents = commitEvents;
}

protected <T> T withCommitEvents(Boolean commitEvents, T derivedInstance) {
this.commitEvents = commitEvents;
return (derivedInstance);
}

public Boolean getPushEvents() {
return pushEvents;
}
Expand Down Expand Up @@ -237,7 +260,7 @@ public void setProperties(Map<String, Object> properties) {

@JsonIgnore
protected String getProperty(String prop) {
return ((String) getProperty(prop, ""));
return (getProperty(prop, ""));
}

@JsonIgnore
Expand Down Expand Up @@ -270,4 +293,13 @@ protected void setProperty(String prop, Object value) {
public String toString() {
return (JacksonJson.toJsonString(this));
}

public enum BranchesToBeNotified {
ALL, DEFAULT, PROTECTED, DEFAULT_AND_PROTECTED;
@Override
public String toString() {
return (name().toLowerCase());
}
}

}
Loading