Move change batch loading from ChangeData to ChangeNotes.Factory
All remaining code that loads changes in batches from the database should go into ChangeNotes.Factory. Change-Id: I37170a6b6fbc8d179c0467a41f0551fac3198f20 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
parent
eec1c4856d
commit
a048124c8e
@ -231,6 +231,26 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
change.getProject(), change).load();
|
||||
}
|
||||
|
||||
public List<ChangeNotes> create(ReviewDb db,
|
||||
Collection<Change.Id> changeIds) throws OrmException {
|
||||
List<ChangeNotes> notes = new ArrayList<>();
|
||||
if (migration.enabled()) {
|
||||
for (Change.Id changeId : changeIds) {
|
||||
try {
|
||||
notes.add(createChecked(changeId));
|
||||
} catch (NoSuchChangeException e) {
|
||||
// Ignore missing changes to match Access#get(Iterable) behavior.
|
||||
}
|
||||
}
|
||||
return notes;
|
||||
}
|
||||
|
||||
for (Change c : db.changes().get(changeIds)) {
|
||||
notes.add(createFromChangeOnlyWhenNotedbDisabled(c));
|
||||
}
|
||||
return notes;
|
||||
}
|
||||
|
||||
public List<ChangeNotes> create(ReviewDb db, Project.NameKey project,
|
||||
Collection<Change.Id> changeIds, Predicate<ChangeNotes> predicate)
|
||||
throws OrmException {
|
||||
|
@ -128,8 +128,9 @@ public class ChangeData {
|
||||
if (missing.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (Change change : first.db.changes().get(missing.keySet())) {
|
||||
missing.get(change.getId()).change = change;
|
||||
for (ChangeNotes notes : first.notesFactory.create(
|
||||
first.db, missing.keySet())) {
|
||||
missing.get(notes.getChangeId()).change = notes.getChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user