Search in sources :

Example 96 with Change

use of com.google.gerrit.reviewdb.client.Change in project gerrit by GerritCodeReview.

the class StreamEventsApiListener method onReviewerDeleted.

@Override
public void onReviewerDeleted(final ReviewerDeletedListener.Event ev) {
    try {
        ChangeNotes notes = getNotes(ev.getChange());
        Change change = notes.getChange();
        ReviewerDeletedEvent event = new ReviewerDeletedEvent(change);
        event.change = changeAttributeSupplier(change);
        event.patchSet = patchSetAttributeSupplier(change, psUtil.current(db.get(), notes));
        event.reviewer = accountAttributeSupplier(ev.getReviewer());
        event.comment = ev.getComment();
        event.approvals = approvalsAttributeSupplier(change, ev.getNewApprovals(), ev.getOldApprovals());
        dispatcher.get().postEvent(change, event);
    } catch (OrmException e) {
        log.error("Failed to dispatch event", e);
    }
}
Also used : OrmException(com.google.gwtorm.server.OrmException) ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.reviewdb.client.Change)

Example 97 with Change

use of com.google.gerrit.reviewdb.client.Change in project gerrit by GerritCodeReview.

the class StreamEventsApiListener method onChangeMerged.

@Override
public void onChangeMerged(ChangeMergedListener.Event ev) {
    try {
        ChangeNotes notes = getNotes(ev.getChange());
        Change change = notes.getChange();
        ChangeMergedEvent event = new ChangeMergedEvent(change);
        event.change = changeAttributeSupplier(change);
        event.submitter = accountAttributeSupplier(ev.getWho());
        event.patchSet = patchSetAttributeSupplier(change, psUtil.current(db.get(), notes));
        event.newRev = ev.getNewRevisionId();
        dispatcher.get().postEvent(change, event);
    } catch (OrmException e) {
        log.error("Failed to dispatch event", e);
    }
}
Also used : OrmException(com.google.gwtorm.server.OrmException) ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.reviewdb.client.Change)

Example 98 with Change

use of com.google.gerrit.reviewdb.client.Change in project gerrit by GerritCodeReview.

the class StreamEventsApiListener method onDraftPublished.

@Override
public void onDraftPublished(DraftPublishedListener.Event ev) {
    try {
        ChangeNotes notes = getNotes(ev.getChange());
        Change change = notes.getChange();
        PatchSet ps = getPatchSet(notes, ev.getRevision());
        DraftPublishedEvent event = new DraftPublishedEvent(change);
        event.change = changeAttributeSupplier(change);
        event.patchSet = patchSetAttributeSupplier(change, ps);
        event.uploader = accountAttributeSupplier(ev.getWho());
        dispatcher.get().postEvent(change, event);
    } catch (OrmException e) {
        log.error("Failed to dispatch event", e);
    }
}
Also used : OrmException(com.google.gwtorm.server.OrmException) PatchSet(com.google.gerrit.reviewdb.client.PatchSet) ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.reviewdb.client.Change)

Example 99 with Change

use of com.google.gerrit.reviewdb.client.Change in project gerrit by GerritCodeReview.

the class StreamEventsApiListener method onChangeRestored.

@Override
public void onChangeRestored(ChangeRestoredListener.Event ev) {
    try {
        ChangeNotes notes = getNotes(ev.getChange());
        Change change = notes.getChange();
        ChangeRestoredEvent event = new ChangeRestoredEvent(change);
        event.change = changeAttributeSupplier(change);
        event.restorer = accountAttributeSupplier(ev.getWho());
        event.patchSet = patchSetAttributeSupplier(change, psUtil.current(db.get(), notes));
        event.reason = ev.getReason();
        dispatcher.get().postEvent(change, event);
    } catch (OrmException e) {
        log.error("Failed to dispatch event", e);
    }
}
Also used : OrmException(com.google.gwtorm.server.OrmException) ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.reviewdb.client.Change)

Example 100 with Change

use of com.google.gerrit.reviewdb.client.Change in project gerrit by GerritCodeReview.

the class StreamEventsApiListener method onTopicEdited.

@Override
public void onTopicEdited(TopicEditedListener.Event ev) {
    try {
        Change change = getChange(ev.getChange());
        TopicChangedEvent event = new TopicChangedEvent(change);
        event.change = changeAttributeSupplier(change);
        event.changer = accountAttributeSupplier(ev.getWho());
        event.oldTopic = ev.getOldTopic();
        dispatcher.get().postEvent(change, event);
    } catch (OrmException e) {
        log.error("Failed to dispatch event", e);
    }
}
Also used : OrmException(com.google.gwtorm.server.OrmException) Change(com.google.gerrit.reviewdb.client.Change)

Aggregations

Change (com.google.gerrit.reviewdb.client.Change)390 Test (org.junit.Test)254 PatchSet (com.google.gerrit.reviewdb.client.PatchSet)103 Repo (com.google.gerrit.testutil.InMemoryRepositoryManager.Repo)65 Timestamp (java.sql.Timestamp)60 ObjectId (org.eclipse.jgit.lib.ObjectId)55 Account (com.google.gerrit.reviewdb.client.Account)52 RevCommit (org.eclipse.jgit.revwalk.RevCommit)50 OrmException (com.google.gwtorm.server.OrmException)46 RevId (com.google.gerrit.reviewdb.client.RevId)45 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)36 PatchSetApproval (com.google.gerrit.reviewdb.client.PatchSetApproval)35 Comment (com.google.gerrit.reviewdb.client.Comment)34 Project (com.google.gerrit.reviewdb.client.Project)34 ChangeNotes (com.google.gerrit.server.notedb.ChangeNotes)34 Repository (org.eclipse.jgit.lib.Repository)34 ChangeMessage (com.google.gerrit.reviewdb.client.ChangeMessage)30 CommentRange (com.google.gerrit.reviewdb.client.CommentRange)30 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)29 RevWalk (org.eclipse.jgit.revwalk.RevWalk)29