Merge "Add abstract methods to the ChangeEvent hierarchy"
This commit is contained in:
commit
8897d1c185
@ -14,14 +14,38 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
|
||||
public class ChangeAbandonedEvent extends ChangeEvent {
|
||||
public final String type = "change-abandoned";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute abandoner;
|
||||
public String reason;
|
||||
public final String type = "change-abandoned";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute abandoner;
|
||||
public String reason;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,15 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
|
||||
public abstract class ChangeEvent {
|
||||
public abstract String getType();
|
||||
|
||||
public abstract Project.NameKey getProjectNameKey();
|
||||
|
||||
public abstract Change.Key getChangeKey();
|
||||
|
||||
public abstract String getRefName();
|
||||
}
|
||||
|
@ -14,13 +14,37 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
|
||||
public class ChangeMergedEvent extends ChangeEvent {
|
||||
public final String type = "change-merged";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute submitter;
|
||||
public final String type = "change-merged";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute submitter;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
||||
|
@ -14,14 +14,38 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
|
||||
public class ChangeRestoredEvent extends ChangeEvent {
|
||||
public final String type = "change-restored";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute restorer;
|
||||
public String reason;
|
||||
public final String type = "change-restored";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute restorer;
|
||||
public String reason;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
||||
|
@ -14,16 +14,40 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ApprovalAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
|
||||
public class CommentAddedEvent extends ChangeEvent {
|
||||
public final String type = "comment-added";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute author;
|
||||
public ApprovalAttribute[] approvals;
|
||||
public String comment;
|
||||
public final String type = "comment-added";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute author;
|
||||
public ApprovalAttribute[] approvals;
|
||||
public String comment;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
|
||||
@ -21,6 +22,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.transport.ReceiveCommand;
|
||||
|
||||
public class CommitReceivedEvent extends ChangeEvent {
|
||||
public final String type = "commit-received";
|
||||
public final ReceiveCommand command;
|
||||
public final Project project;
|
||||
public final String refName;
|
||||
@ -35,4 +37,24 @@ public class CommitReceivedEvent extends ChangeEvent {
|
||||
this.commit = commit;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return project.getNameKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return refName;
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,37 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
|
||||
public class DraftPublishedEvent extends ChangeEvent {
|
||||
public final String type = "draft-published";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute uploader;
|
||||
public final String type = "draft-published";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute uploader;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,10 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
|
||||
@ -24,4 +28,24 @@ public class HashtagsChangedEvent extends ChangeEvent {
|
||||
public String[] added;
|
||||
public String[] removed;
|
||||
public String[] hashtags;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
@ -14,14 +14,38 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
|
||||
public class MergeFailedEvent extends ChangeEvent {
|
||||
public final String type = "merge-failed";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute submitter;
|
||||
public String reason;
|
||||
public final String type = "merge-failed";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute submitter;
|
||||
public String reason;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,37 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
|
||||
public class PatchSetCreatedEvent extends ChangeEvent {
|
||||
public final String type = "patchset-created";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute uploader;
|
||||
public final String type = "patchset-created";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute uploader;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
|
||||
@ -23,4 +24,24 @@ public class RefOperationReceivedEvent extends ChangeEvent {
|
||||
public ReceiveCommand command;
|
||||
public Project project;
|
||||
public IdentifiedUser user;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return project.getNameKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return command.getRefName();
|
||||
}
|
||||
}
|
@ -14,6 +14,8 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.RefUpdateAttribute;
|
||||
|
||||
@ -21,4 +23,24 @@ public class RefUpdatedEvent extends ChangeEvent {
|
||||
public final String type = "ref-updated";
|
||||
public AccountAttribute submitter;
|
||||
public RefUpdateAttribute refUpdate;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(refUpdate.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return refUpdate.refName;
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,37 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
import com.google.gerrit.server.data.PatchSetAttribute;
|
||||
|
||||
public class ReviewerAddedEvent extends ChangeEvent {
|
||||
public final String type = "reviewer-added";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute reviewer;
|
||||
public final String type = "reviewer-added";
|
||||
public ChangeAttribute change;
|
||||
public PatchSetAttribute patchSet;
|
||||
public AccountAttribute reviewer;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,10 @@
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
import com.google.gerrit.server.data.ChangeAttribute;
|
||||
|
||||
@ -22,4 +26,24 @@ public class TopicChangedEvent extends ChangeEvent {
|
||||
public ChangeAttribute change;
|
||||
public AccountAttribute changer;
|
||||
public String oldTopic;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(change.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change.Key getChangeKey() {
|
||||
return new Change.Key(change.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefName() {
|
||||
return R_HEADS + change.branch;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user