Search in sources :

Example 66 with StorageException

use of com.google.gerrit.exceptions.StorageException in project gerrit by GerritCodeReview.

the class StreamEventsApiListener method onTopicEdited.

@Override
public void onTopicEdited(TopicEditedListener.Event ev) {
    try {
        ChangeNotes notes = getNotes(ev.getChange());
        Change change = notes.getChange();
        TopicChangedEvent event = new TopicChangedEvent(change);
        event.change = changeAttributeSupplier(change, notes);
        event.changer = accountAttributeSupplier(ev.getWho());
        event.oldTopic = ev.getOldTopic();
        dispatcher.run(d -> d.postEvent(change, event));
    } catch (StorageException e) {
        logger.atSevere().withCause(e).log("Failed to dispatch event");
    }
}
Also used : ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.entities.Change) StorageException(com.google.gerrit.exceptions.StorageException)

Example 67 with StorageException

use of com.google.gerrit.exceptions.StorageException in project gerrit by GerritCodeReview.

the class StreamEventsApiListener method onReviewerDeleted.

@Override
public void onReviewerDeleted(ReviewerDeletedListener.Event ev) {
    try {
        ChangeNotes notes = getNotes(ev.getChange());
        Change change = notes.getChange();
        ReviewerDeletedEvent event = new ReviewerDeletedEvent(change);
        event.change = changeAttributeSupplier(change, notes);
        event.patchSet = patchSetAttributeSupplier(change, psUtil.current(notes));
        event.reviewer = accountAttributeSupplier(ev.getReviewer());
        event.remover = accountAttributeSupplier(ev.getWho());
        event.comment = ev.getComment();
        event.approvals = approvalsAttributeSupplier(change, ev.getNewApprovals(), ev.getOldApprovals());
        dispatcher.run(d -> d.postEvent(change, event));
    } catch (StorageException e) {
        logger.atSevere().withCause(e).log("Failed to dispatch event");
    }
}
Also used : ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.entities.Change) StorageException(com.google.gerrit.exceptions.StorageException)

Example 68 with StorageException

use of com.google.gerrit.exceptions.StorageException 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, notes);
        event.restorer = 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");
    }
}
Also used : ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.entities.Change) StorageException(com.google.gerrit.exceptions.StorageException)

Example 69 with StorageException

use of com.google.gerrit.exceptions.StorageException 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, notes);
        event.submitter = accountAttributeSupplier(ev.getWho());
        event.patchSet = patchSetAttributeSupplier(change, psUtil.current(notes));
        event.newRev = ev.getNewRevisionId();
        dispatcher.run(d -> d.postEvent(change, event));
    } catch (StorageException e) {
        logger.atSevere().withCause(e).log("Failed to dispatch event");
    }
}
Also used : ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.entities.Change) StorageException(com.google.gerrit.exceptions.StorageException)

Example 70 with StorageException

use of com.google.gerrit.exceptions.StorageException in project gerrit by GerritCodeReview.

the class StreamEventsApiListener method onPrivateStateChanged.

@Override
public void onPrivateStateChanged(PrivateStateChangedListener.Event ev) {
    try {
        ChangeNotes notes = getNotes(ev.getChange());
        Change change = notes.getChange();
        PatchSet patchSet = getPatchSet(notes, ev.getRevision());
        PrivateStateChangedEvent event = new PrivateStateChangedEvent(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");
    }
}
Also used : PatchSet(com.google.gerrit.entities.PatchSet) ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) Change(com.google.gerrit.entities.Change) StorageException(com.google.gerrit.exceptions.StorageException)

Aggregations

StorageException (com.google.gerrit.exceptions.StorageException)153 IOException (java.io.IOException)68 Change (com.google.gerrit.entities.Change)47 ObjectId (org.eclipse.jgit.lib.ObjectId)37 Repository (org.eclipse.jgit.lib.Repository)33 ChangeNotes (com.google.gerrit.server.notedb.ChangeNotes)30 PatchSet (com.google.gerrit.entities.PatchSet)29 RevCommit (org.eclipse.jgit.revwalk.RevCommit)28 ArrayList (java.util.ArrayList)25 ConfigInvalidException (org.eclipse.jgit.errors.ConfigInvalidException)24 Project (com.google.gerrit.entities.Project)22 Ref (org.eclipse.jgit.lib.Ref)22 ChangeData (com.google.gerrit.server.query.change.ChangeData)21 RevWalk (org.eclipse.jgit.revwalk.RevWalk)21 Account (com.google.gerrit.entities.Account)20 Inject (com.google.inject.Inject)19 Map (java.util.Map)19 Test (org.junit.Test)19 List (java.util.List)18 BranchNameKey (com.google.gerrit.entities.BranchNameKey)17