Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: eacc1f51bfdb8b8a3ecf16f01779a545c30bdb45 (plain) (blame)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*******************************************************************************
 *  Copyright (c) 2011 GitHub Inc.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License 2.0
 *  which accompanies this distribution, and is available at
 *  https://www.eclipse.org/legal/epl-2.0/
 *
 *  SPDX-License-Identifier: EPL-2.0
 *
 *  Contributors:
 *    Jason Tsay (GitHub Inc.) - initial API and implementation
 *******************************************************************************/
package org.eclipse.egit.github.core.event;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Date;

import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.util.DateUtils;

/**
 * Event model class.
 */
public class Event implements Serializable {

	/**
	 * Event type denoting a {@link CommitCommentPayload}
	 */
	public static final String TYPE_COMMIT_COMMENT = "CommitCommentEvent";

	/**
	 * Event type denoting a {@link CreatePayload}
	 */
	public static final String TYPE_CREATE = "CreateEvent";

	/**
	 * Event type denoting a {@link DeletePayload}
	 */
	public static final String TYPE_DELETE = "DeleteEvent";

	/**
	 * Event type denoting a {@link DownloadPayload}
	 */
	public static final String TYPE_DOWNLOAD = "DownloadEvent";

	/**
	 * Event type dneoting a {@link FollowPayload}
	 */
	public static final String TYPE_FOLLOW = "FollowEvent";

	/**
	 * Event type denoting a {@link ForkPayload}
	 */
	public static final String TYPE_FORK = "ForkEvent";

	/**
	 * Event type denoting a {@link ForkApplyPayload}
	 */
	public static final String TYPE_FORK_APPLY = "ForkApplyEvent";

	/**
	 * Event type denoting a {@link GistPayload}
	 */
	public static final String TYPE_GIST = "GistEvent";

	/**
	 * Event type denoting a {@link GollumPayload}
	 */
	public static final String TYPE_GOLLUM = "GollumEvent";

	/**
	 * Event type denoting a {@link IssueCommentPayload}
	 */
	public static final String TYPE_ISSUE_COMMENT = "IssueCommentEvent";

	/**
	 * Event type denoting a {@link IssuesPayload}
	 */
	public static final String TYPE_ISSUES = "IssuesEvent";

	/**
	 * Event type denoting a {@link MemberPayload}
	 */
	public static final String TYPE_MEMBER = "MemberEvent";

	/**
	 * Event type denoting a {@link PublicPayload}
	 */
	public static final String TYPE_PUBLIC = "PublicEvent";

	/**
	 * Event type denoting a {@link PullRequestPayload}
	 */
	public static final String TYPE_PULL_REQUEST = "PullRequestEvent";

	/**
	 * Event type denoting a {@link PullRequestReviewCommentPayload}
	 */
	public static final String TYPE_PULL_REQUEST_REVIEW_COMMENT = "PullRequestReviewCommentEvent";

	/**
	 * Event type denoting a {@link PushPayload}
	 */
	public static final String TYPE_PUSH = "PushEvent";

	/**
	 * Event type denoting a {@link ReleasePayload}
	 */
	public static final String TYPE_RELEASE = "ReleaseEvent";

	/**
	 * Event type denoting a {@link TeamAddPayload}
	 */
	public static final String TYPE_TEAM_ADD = "TeamAddEvent";

	/**
	 * Event type denoting a {@link WatchPayload}
	 */
	public static final String TYPE_WATCH = "WatchEvent";

	private static final long serialVersionUID = 3633702964380402233L;

	/**
	 * Make sure this is above payload. Payload deserialization depends on being
	 * able to read the type first.
	 */
	private String type;

	@SerializedName("public")
	private boolean isPublic;

	private EventPayload payload;

	private EventRepository repo;

	private String id;

	private User actor;

	private User org;

	private Date createdAt;

	/**
	 * @return type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type
	 * @return this Event
	 */
	public Event setType(String type) {
		this.type = type;
		return this;
	}

	/**
	 * @return isPublic
	 */
	public boolean isPublic() {
		return isPublic;
	}

	/**
	 * @param isPublic
	 * @return this Event
	 */
	public Event setPublic(boolean isPublic) {
		this.isPublic = isPublic;
		return this;
	}

	/**
	 * @return the repo
	 */
	public EventRepository getRepo() {
		return repo;
	}

	/**
	 * @param repo
	 * @return this Event
	 */
	public Event setRepo(EventRepository repo) {
		this.repo = repo;
		return this;
	}

	/**
	 * @return the actor
	 */
	public User getActor() {
		return actor;
	}

	/**
	 * @param actor
	 * @return this Event
	 */
	public Event setActor(User actor) {
		this.actor = actor;
		return this;
	}

	/**
	 * @return the org
	 */
	public User getOrg() {
		return org;
	}

	/**
	 * @param org
	 * @return this Event
	 */
	public Event setOrg(User org) {
		this.org = org;
		return this;
	}

	/**
	 * @return the createdAt
	 */
	public Date getCreatedAt() {
		return DateUtils.clone(createdAt);
	}

	/**
	 * @param createdAt
	 * @return this Event
	 */
	public Event setCreatedAt(Date createdAt) {
		this.createdAt = DateUtils.clone(createdAt);
		return this;
	}

	/**
	 * @return payload
	 */
	public EventPayload getPayload() {
		return payload;
	}

	/**
	 * @param payload
	 * @return this event
	 */
	public Event setPayload(EventPayload payload) {
		this.payload = payload;
		return this;
	}

	/**
	 * @return id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id
	 * @return this event
	 */
	public Event setId(String id) {
		this.id = id;
		return this;
	}
}

Back to the top