Skip to content

Commit ab48610

Browse files
committed
Initial commit (#175 and #176).
1 parent 6028d80 commit ab48610

File tree

1 file changed

+261
-0
lines changed

1 file changed

+261
-0
lines changed
Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
package org.gitlab4j.api.services;
2+
3+
import java.util.Date;
4+
import java.util.HashMap;
5+
import java.util.Map;
6+
7+
import javax.xml.bind.annotation.XmlAccessType;
8+
import javax.xml.bind.annotation.XmlAccessorType;
9+
10+
import com.fasterxml.jackson.annotation.JsonIgnore;
11+
12+
@XmlAccessorType(XmlAccessType.FIELD)
13+
public abstract class NotificationService {
14+
15+
private Integer id;
16+
private String title;
17+
private Date createdAt;
18+
private Date updatedAt;
19+
private Boolean active;
20+
21+
private Boolean pushEvents;
22+
private Boolean issuesEvents;
23+
private Boolean confidentialIssuesEvents;
24+
private Boolean commitEvents;
25+
private Boolean mergeRequestsEvents;
26+
private Boolean tagPushEvents;
27+
private Boolean noteEvents;
28+
private Boolean confidentialNoteEvents;
29+
private Boolean pipelineEvents;
30+
private Boolean wikiPageEvents;
31+
private Boolean jobEvents;
32+
33+
private Map<String, Object> properties;
34+
35+
public Integer getId() {
36+
return id;
37+
}
38+
39+
public void setId(Integer id) {
40+
this.id = id;
41+
}
42+
43+
public String getTitle() {
44+
return title;
45+
}
46+
47+
public void setTitle(String title) {
48+
this.title = title;
49+
}
50+
51+
public Date getCreatedAt() {
52+
return createdAt;
53+
}
54+
55+
public void setCreatedAt(Date createdAt) {
56+
this.createdAt = createdAt;
57+
}
58+
59+
public Date getUpdatedAt() {
60+
return updatedAt;
61+
}
62+
63+
public void setUpdatedAt(Date updatedAt) {
64+
this.updatedAt = updatedAt;
65+
}
66+
67+
public Boolean getActive() {
68+
return active;
69+
}
70+
71+
public void setActive(Boolean active) {
72+
this.active = active;
73+
}
74+
75+
// *******************************************************************************
76+
// The following methods can be used to configure the notification service
77+
// *******************************************************************************
78+
79+
public Boolean getPushEvents() {
80+
return pushEvents;
81+
}
82+
83+
public void setPushEvents(Boolean pushEvents) {
84+
this.pushEvents = pushEvents;
85+
}
86+
87+
public <T> T withPushEvents(Boolean pushEvents, T derivedInstance) {
88+
this.pushEvents = pushEvents;
89+
return (derivedInstance);
90+
}
91+
92+
public Boolean getIssuesEvents() {
93+
return issuesEvents;
94+
}
95+
96+
public void setIssuesEvents(Boolean issuesEvents) {
97+
this.issuesEvents = issuesEvents;
98+
}
99+
100+
public <T> T withIssuesEvents(Boolean issuesEvents, T derivedInstance) {
101+
this.issuesEvents = issuesEvents;
102+
return (derivedInstance);
103+
}
104+
105+
public Boolean getConfidentialIssuesEvents() {
106+
return confidentialIssuesEvents;
107+
}
108+
109+
public void setConfidentialIssuesEvents(Boolean confidentialIssuesEvents) {
110+
this.confidentialIssuesEvents = confidentialIssuesEvents;
111+
}
112+
113+
public <T> T withConfidentialIssuesEvents(Boolean confidentialIssuesEvents, T derivedInstance) {
114+
this.confidentialIssuesEvents = confidentialIssuesEvents;
115+
return (derivedInstance);
116+
}
117+
118+
@JsonIgnore
119+
public Boolean getCommitEvents() {
120+
return commitEvents;
121+
}
122+
123+
public void setCommitEvents(Boolean commitEvents) {
124+
this.commitEvents = commitEvents;
125+
}
126+
127+
public <T> T withCommitEvents(Boolean commitEvents, T derivedInstance) {
128+
setCommitEvents(commitEvents);
129+
return (derivedInstance);
130+
}
131+
132+
public Boolean getMergeRequestsEvents() {
133+
return mergeRequestsEvents;
134+
}
135+
136+
public void setMergeRequestsEvents(Boolean mergeRequestsEvents) {
137+
this.mergeRequestsEvents = mergeRequestsEvents;
138+
}
139+
140+
public <T> T withMergeRequestsEvents(Boolean mergeRequestsEvents, T derivedInstance) {
141+
this.mergeRequestsEvents = mergeRequestsEvents;
142+
return (derivedInstance);
143+
}
144+
145+
public Boolean getTagPushEvents() {
146+
return tagPushEvents;
147+
}
148+
149+
public void setTagPushEvents(Boolean tagPushEvents) {
150+
this.tagPushEvents = tagPushEvents;
151+
}
152+
153+
public <T> T withTagPushEvents(Boolean tagPushEvents, T derivedInstance) {
154+
this.tagPushEvents = tagPushEvents;
155+
return (derivedInstance);
156+
}
157+
158+
public Boolean getNoteEvents() {
159+
return noteEvents;
160+
}
161+
162+
public void setNoteEvents(Boolean noteEvents) {
163+
this.noteEvents = noteEvents;
164+
}
165+
166+
public <T> T withNoteEvents(Boolean noteEvents, T derivedInstance) {
167+
this.noteEvents = noteEvents;
168+
return (derivedInstance);
169+
}
170+
171+
public Boolean getConfidentialNoteEvents() {
172+
return confidentialNoteEvents;
173+
}
174+
175+
public void setConfidentialNoteEvents(Boolean confidentialNoteEvents) {
176+
this.confidentialNoteEvents = confidentialNoteEvents;
177+
}
178+
179+
public <T> T withConfidentialNoteEvents(Boolean confidentialNoteEvents, T derivedInstance) {
180+
this.confidentialNoteEvents = confidentialNoteEvents;
181+
return (derivedInstance);
182+
}
183+
184+
public Boolean getPipelineEvents() {
185+
return pipelineEvents;
186+
}
187+
188+
public void setPipelineEvents(Boolean pipelineEvents) {
189+
this.pipelineEvents = pipelineEvents;
190+
}
191+
192+
public <T> T withPipelineEvents(Boolean pipelineEvents, T derivedInstance) {
193+
this.pipelineEvents = pipelineEvents;
194+
return (derivedInstance);
195+
}
196+
197+
public Boolean getWikiPageEvents() {
198+
return wikiPageEvents;
199+
}
200+
201+
public void setWikiPageEvents(Boolean wikiPageEvents) {
202+
this.wikiPageEvents = wikiPageEvents;
203+
}
204+
205+
public <T> T withWikiPageEvents(Boolean wikiPageEvents, T derivedInstance) {
206+
this.wikiPageEvents = wikiPageEvents;
207+
return (derivedInstance);
208+
}
209+
210+
public Boolean getJobEvents() {
211+
return jobEvents;
212+
}
213+
214+
public void setJobEvents(Boolean jobEvents) {
215+
this.jobEvents = jobEvents;
216+
}
217+
218+
public <T> T withJobEvents(Boolean jobEvents, T derivedInstance) {
219+
this.jobEvents = jobEvents;
220+
return (derivedInstance);
221+
}
222+
223+
public Map<String, Object> getProperties() {
224+
return (properties);
225+
}
226+
227+
public void setProperties(Map<String, Object> properties) {
228+
this.properties = properties;
229+
}
230+
231+
@JsonIgnore
232+
protected String getProperty(String prop) {
233+
return ((String) getProperty(prop, ""));
234+
}
235+
236+
@JsonIgnore
237+
@SuppressWarnings("unchecked")
238+
protected <T> T getProperty(String prop, T defaultValue) {
239+
240+
Object value = (properties != null ? properties.get(prop) : null);
241+
242+
// HACK: Sometimes GitLab returns "0" or "1" for true/false
243+
if (value != null && Boolean.class.isInstance(defaultValue)) {
244+
if ("0".equals(value)) {
245+
return ((T) Boolean.FALSE);
246+
} else if ("1".equals(value)) {
247+
return ((T) Boolean.TRUE);
248+
}
249+
}
250+
251+
return ((T) (value != null ? value : defaultValue));
252+
}
253+
254+
protected void setProperty(String prop, Object value) {
255+
if (properties == null) {
256+
properties = new HashMap<>(16);
257+
}
258+
259+
properties.put(prop, value);
260+
}
261+
}

0 commit comments

Comments
 (0)