Search in sources :

Example 1 with Id

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

the class NoteDbModule method configure.

@Override
public void configure() {
    factory(ChangeUpdate.Factory.class);
    factory(ChangeDraftUpdate.Factory.class);
    factory(DeleteCommentRewriter.Factory.class);
    factory(DraftCommentNotes.Factory.class);
    factory(RobotCommentUpdate.Factory.class);
    factory(RobotCommentNotes.Factory.class);
    factory(NoteDbUpdateManager.Factory.class);
    if (!useTestBindings) {
        install(ChangeNotesCache.module());
        if (cfg.getBoolean("noteDb", null, "testRebuilderWrapper", false)) {
            // Yes, another variety of test bindings with a different way of
            // configuring it.
            bind(ChangeRebuilder.class).to(TestChangeRebuilderWrapper.class);
        } else {
            bind(ChangeRebuilder.class).to(ChangeRebuilderImpl.class);
        }
    } else {
        bind(ChangeRebuilder.class).toInstance(new ChangeRebuilder(null) {

            @Override
            public Result rebuild(ReviewDb db, Change.Id changeId) {
                return null;
            }

            @Override
            public Result rebuildEvenIfReadOnly(ReviewDb db, Id changeId) {
                return null;
            }

            @Override
            public Result rebuild(NoteDbUpdateManager manager, ChangeBundle bundle) {
                return null;
            }

            @Override
            public NoteDbUpdateManager stage(ReviewDb db, Change.Id changeId) {
                return null;
            }

            @Override
            public Result execute(ReviewDb db, Change.Id changeId, NoteDbUpdateManager manager) {
                return null;
            }

            @Override
            public void buildUpdates(NoteDbUpdateManager manager, ChangeBundle bundle) {
            // Do nothing.
            }

            @Override
            public void rebuildReviewDb(ReviewDb db, Project.NameKey project, Id changeId) {
            // Do nothing.
            }
        });
        bind(new TypeLiteral<Cache<ChangeNotesCache.Key, ChangeNotesState>>() {
        }).annotatedWith(Names.named(ChangeNotesCache.CACHE_NAME)).toInstance(CacheBuilder.newBuilder().<ChangeNotesCache.Key, ChangeNotesState>build());
    }
}
Also used : Change(com.google.gerrit.reviewdb.client.Change) Result(com.google.gerrit.server.notedb.NoteDbUpdateManager.Result) Project(com.google.gerrit.reviewdb.client.Project) Id(com.google.gerrit.reviewdb.client.Change.Id) Id(com.google.gerrit.reviewdb.client.Change.Id) ChangeRebuilder(com.google.gerrit.server.notedb.rebuild.ChangeRebuilder) ReviewDb(com.google.gerrit.reviewdb.server.ReviewDb) Cache(com.google.common.cache.Cache)

Aggregations

Cache (com.google.common.cache.Cache)1 Change (com.google.gerrit.reviewdb.client.Change)1 Id (com.google.gerrit.reviewdb.client.Change.Id)1 Project (com.google.gerrit.reviewdb.client.Project)1 ReviewDb (com.google.gerrit.reviewdb.server.ReviewDb)1 Result (com.google.gerrit.server.notedb.NoteDbUpdateManager.Result)1 ChangeRebuilder (com.google.gerrit.server.notedb.rebuild.ChangeRebuilder)1