Skip to content

Commit

Permalink
added setPayload to IssuesEvent and PushEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Jan 21, 2015
1 parent e3ad716 commit 88e3daa
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
import com.skiwi.githubhooksechatservice.events.github.classes.Issue;
import com.skiwi.githubhooksechatservice.events.github.classes.Label;
import com.skiwi.githubhooksechatservice.events.github.classes.User;
Expand All @@ -12,6 +14,7 @@
*
* @author Frank van Heeswijk
*/
@JsonTypeInfo(use = Id.NAME, defaultImpl = IssuesEvent.class)
public final class IssuesEvent extends GithubEvent {
@JsonProperty
private String action;
Expand Down Expand Up @@ -93,4 +96,13 @@ public boolean equals(final Object obj) {
}
return true;
}

public void setPayload(IssuesEvent event) {
this.action = event.action;
this.assignee = event.assignee;
this.issue = event.issue;
this.sender = event.sender;
this.label = event.label;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.skiwi.githubhooksechatservice.events.AnySetterJSONObject;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
import com.skiwi.githubhooksechatservice.events.github.classes.LegacyCommit;
import com.skiwi.githubhooksechatservice.events.github.classes.LegacyRepository;
import com.skiwi.githubhooksechatservice.events.github.classes.LegacySimpleUser;
Expand All @@ -16,7 +17,8 @@
*
* @author Frank van Heeswijk
*/
public final class PushEvent extends AnySetterJSONObject {
@JsonTypeInfo(use = Id.NAME, defaultImpl = PushEvent.class)
public final class PushEvent extends AbstractEvent {
@JsonProperty
private String ref;

Expand Down Expand Up @@ -177,4 +179,20 @@ public boolean equals(final Object obj) {
}
return true;
}

public void setPayload(PushEvent event) {
this.after = event.after;
this.baseRef = event.baseRef;
this.before = event.before;
this.commits = event.commits;
this.compare = event.compare;
this.created = event.created;
this.deleted = event.deleted;
this.forced = event.forced;
this.headCommit = event.headCommit;
this.organization = event.organization;
this.pusher = event.pusher;
this.ref = event.ref;
this.repository = event.repository;
}
}

0 comments on commit 88e3daa

Please sign in to comment.