use of com.google.gerrit.server.notedb.ChangeNotes in project gerrit by GerritCodeReview.
the class StreamEventsApiListener method onChangeDeleted.
@Override
public void onChangeDeleted(ChangeDeletedListener.Event ev) {
try {
ChangeNotes notes = getNotes(ev.getChange());
Change change = notes.getChange();
ChangeDeletedEvent event = new ChangeDeletedEvent(change);
event.change = changeAttributeSupplier(change, notes);
event.deleter = accountAttributeSupplier(ev.getWho());
dispatcher.run(d -> d.postEvent(change, event));
} catch (StorageException e) {
logger.atSevere().withCause(e).log("Failed to dispatch event");
}
}
use of com.google.gerrit.server.notedb.ChangeNotes in project gerrit by GerritCodeReview.
the class StreamEventsApiListener method onReviewersAdded.
@Override
public void onReviewersAdded(ReviewerAddedListener.Event ev) {
try {
ChangeNotes notes = getNotes(ev.getChange());
Change change = notes.getChange();
ReviewerAddedEvent event = new ReviewerAddedEvent(change);
event.change = changeAttributeSupplier(change, notes);
event.patchSet = patchSetAttributeSupplier(change, psUtil.current(notes));
event.adder = accountAttributeSupplier(ev.getWho());
for (AccountInfo reviewer : ev.getReviewers()) {
event.reviewer = accountAttributeSupplier(reviewer);
dispatcher.run(d -> d.postEvent(event));
}
} catch (StorageException e) {
logger.atSevere().withCause(e).log("Failed to dispatch event");
}
}
use of com.google.gerrit.server.notedb.ChangeNotes in project gerrit by GerritCodeReview.
the class StreamEventsApiListener method onChangeAbandoned.
@Override
public void onChangeAbandoned(ChangeAbandonedListener.Event ev) {
try {
ChangeNotes notes = getNotes(ev.getChange());
Change change = notes.getChange();
ChangeAbandonedEvent event = new ChangeAbandonedEvent(change);
event.change = changeAttributeSupplier(change, notes);
event.abandoner = accountAttributeSupplier(ev.getWho());
event.patchSet = patchSetAttributeSupplier(change, psUtil.current(notes));
event.reason = ev.getReason();
dispatcher.run(d -> d.postEvent(change, event));
} catch (StorageException e) {
logger.atSevere().withCause(e).log("Failed to dispatch event");
}
}
use of com.google.gerrit.server.notedb.ChangeNotes in project gerrit by GerritCodeReview.
the class StreamEventsApiListener method onWorkInProgressStateChanged.
@Override
public void onWorkInProgressStateChanged(WorkInProgressStateChangedListener.Event ev) {
try {
ChangeNotes notes = getNotes(ev.getChange());
Change change = notes.getChange();
PatchSet patchSet = getPatchSet(notes, ev.getRevision());
WorkInProgressStateChangedEvent event = new WorkInProgressStateChangedEvent(change);
event.change = changeAttributeSupplier(change, notes);
event.changer = accountAttributeSupplier(ev.getWho());
event.patchSet = patchSetAttributeSupplier(change, patchSet);
dispatcher.run(d -> d.postEvent(change, event));
} catch (StorageException e) {
logger.atSevere().withCause(e).log("Failed to dispatch event");
}
}
use of com.google.gerrit.server.notedb.ChangeNotes in project gerrit by GerritCodeReview.
the class StreamEventsApiListener method onRevisionCreated.
@Override
public void onRevisionCreated(RevisionCreatedListener.Event ev) {
try {
ChangeNotes notes = getNotes(ev.getChange());
Change change = notes.getChange();
PatchSet patchSet = getPatchSet(notes, ev.getRevision());
PatchSetCreatedEvent event = new PatchSetCreatedEvent(change);
event.change = changeAttributeSupplier(change, notes);
event.patchSet = patchSetAttributeSupplier(change, patchSet);
event.uploader = accountAttributeSupplier(ev.getWho());
dispatcher.run(d -> d.postEvent(change, event));
} catch (StorageException e) {
logger.atSevere().withCause(e).log("Failed to dispatch event");
}
}
Aggregations