Skip to content

Commit 97b50e8

Browse files
committed
Mods to support requestUrl and requestQuesyString properties (#238).
1 parent 3bbacbd commit 97b50e8

21 files changed

+126
-20
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.gitlab4j.api.systemhooks;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnore;
4+
5+
public abstract class AbstractSystemHookEvent implements SystemHookEvent {
6+
7+
private String requestUrl;
8+
private String requestQuesryString;
9+
10+
@Override
11+
public void setRequestUrl(String requestUrl) {
12+
this.requestUrl = requestUrl;
13+
}
14+
15+
@Override
16+
@JsonIgnore
17+
public String getRequestUrl() {
18+
return (requestUrl);
19+
}
20+
21+
@Override
22+
public void setRequestQueryString(String requestQuesryString) {
23+
this.requestQuesryString = requestQuesryString;
24+
}
25+
26+
@Override
27+
@JsonIgnore
28+
public String getRequestQueryString() {
29+
return (requestQuesryString);
30+
}
31+
}

src/main/java/org/gitlab4j/api/systemhooks/GroupMemberSystemHookEvent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
@XmlRootElement
1010
@XmlAccessorType(XmlAccessType.FIELD)
11-
public class GroupMemberSystemHookEvent implements SystemHookEvent {
12-
11+
public class GroupMemberSystemHookEvent extends AbstractSystemHookEvent {
12+
1313
public static final String NEW_GROUP_MEMBER_EVENT = "user_add_to_group";
1414
public static final String GROUP_MEMBER_REMOVED_EVENT = "user_remove_from_group";
15-
15+
1616
private Date createdAt;
1717
private Date updatedAt;
1818
private String eventName;

src/main/java/org/gitlab4j/api/systemhooks/GroupSystemHookEvent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
@XmlRootElement
1010
@XmlAccessorType(XmlAccessType.FIELD)
11-
public class GroupSystemHookEvent implements SystemHookEvent {
11+
public class GroupSystemHookEvent extends AbstractSystemHookEvent {
1212

1313
public static final String GROUP_CREATE_EVENT = "group_create";
1414
public static final String GROUP_DESTROY_EVENT = "group_destroy";
@@ -26,7 +26,6 @@ public class GroupSystemHookEvent implements SystemHookEvent {
2626
private String oldPath;
2727
private String oldFullPath;
2828

29-
3029
public Date getCreatedAt() {
3130
return createdAt;
3231
}

src/main/java/org/gitlab4j/api/systemhooks/KeySystemHookEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
@XmlRootElement
1010
@XmlAccessorType(XmlAccessType.FIELD)
11-
public class KeySystemHookEvent implements SystemHookEvent {
11+
public class KeySystemHookEvent extends AbstractSystemHookEvent {
1212

1313
public static final String KEY_CREATE_EVENT = "key_create";
1414
public static final String KEY_DESTROY_EVENT = "key_destroy";

src/main/java/org/gitlab4j/api/systemhooks/ProjectSystemHookEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@XmlRootElement
1212
@XmlAccessorType(XmlAccessType.FIELD)
13-
public class ProjectSystemHookEvent implements SystemHookEvent {
13+
public class ProjectSystemHookEvent extends AbstractSystemHookEvent {
1414

1515
public static final String PROJECT_CREATE_EVENT = "project_create";
1616
public static final String PROJECT_DESTROY_EVENT = "project_destroy";

src/main/java/org/gitlab4j/api/systemhooks/RepositorySystemHookEvent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@XmlRootElement
1212
@XmlAccessorType(XmlAccessType.FIELD)
13-
public class RepositorySystemHookEvent implements SystemHookEvent {
13+
public class RepositorySystemHookEvent extends AbstractSystemHookEvent {
1414

1515
public static final String REPOSITORY_UPDATE_EVENT = "repository_update";
1616

@@ -26,7 +26,6 @@ public class RepositorySystemHookEvent implements SystemHookEvent {
2626
private List<RepositoryChange> changes;
2727
private List<String> refs;
2828

29-
3029
public String getEventName() {
3130
return (eventName);
3231
}

src/main/java/org/gitlab4j/api/systemhooks/SystemHookEvent.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.gitlab4j.api.systemhooks;
22

3+
import com.fasterxml.jackson.annotation.JsonIgnore;
34
import com.fasterxml.jackson.annotation.JsonSubTypes;
45
import com.fasterxml.jackson.annotation.JsonTypeInfo;
56

@@ -28,7 +29,14 @@
2829
@JsonSubTypes.Type(value = RepositorySystemHookEvent.class, name = RepositorySystemHookEvent.REPOSITORY_UPDATE_EVENT)
2930
})
3031
public interface SystemHookEvent {
31-
public String getEventName();
32+
33+
String getEventName();
34+
35+
void setRequestUrl(String requestUrl);
36+
@JsonIgnore String getRequestUrl();
37+
38+
void setRequestQueryString(String requestQuesryString);
39+
@JsonIgnore String getRequestQueryString();
3240
}
3341

3442
// All of the following class definitions are needed to make the above work.

src/main/java/org/gitlab4j/api/systemhooks/SystemHookManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public void handleEvent(HttpServletRequest request) throws GitLabApiException {
8282
event = jacksonJson.unmarshal(SystemHookEvent.class, reader);
8383
}
8484

85+
event.setRequestUrl(request.getRequestURL().toString());
86+
event.setRequestQueryString(request.getQueryString());
8587
fireEvent(event);
8688

8789
} catch (Exception e) {

src/main/java/org/gitlab4j/api/systemhooks/TeamMemberSystemHookEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@XmlRootElement
1212
@XmlAccessorType(XmlAccessType.FIELD)
13-
public class TeamMemberSystemHookEvent implements SystemHookEvent {
13+
public class TeamMemberSystemHookEvent extends AbstractSystemHookEvent {
1414

1515
public static final String NEW_TEAM_MEMBER_EVENT = "user_add_to_team";
1616
public static final String TEAM_MEMBER_REMOVED_EVENT = "user_remove_from_team";

src/main/java/org/gitlab4j/api/systemhooks/UserSystemHookEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
@XmlRootElement
1010
@XmlAccessorType(XmlAccessType.FIELD)
11-
public class UserSystemHookEvent implements SystemHookEvent {
11+
public class UserSystemHookEvent extends AbstractSystemHookEvent {
1212

1313
public static final String USER_CREATE_EVENT = "user_create";
1414
public static final String USER_DESTROY_EVENT = "user_destroy";

0 commit comments

Comments
 (0)