use of com.google.refine.history.Change in project OpenRefine by OpenRefine.
the class RowStarOperation method createHistoryEntry.
@Override
protected HistoryEntry createHistoryEntry(Project project, long historyEntryID) throws Exception {
Engine engine = createEngine(project);
List<Change> changes = new ArrayList<Change>(project.rows.size());
FilteredRows filteredRows = engine.getAllFilteredRows();
filteredRows.accept(project, createRowVisitor(project, changes));
return new HistoryEntry(historyEntryID, project, (_starred ? "Star" : "Unstar") + " " + changes.size() + " rows", this, new MassChange(changes, false));
}
use of com.google.refine.history.Change in project OpenRefine by OpenRefine.
the class MassChangeTests method testWrongReverseOrder.
/**
* Test case for #914 - Demonstrates MassChange revert doesn't work by
* adding two columns to a project with a MassChange and then reverting.
* Without the fix, column "a" will be removed before column "b", causing
* column "b" removal to fail because it won't be found at index 1 as
* expected.
*/
@Test
public void testWrongReverseOrder() throws Exception {
List<Change> changes = new ArrayList<Change>();
changes.add(new ColumnAdditionChange("a", 0, new ArrayList<CellAtRow>()));
changes.add(new ColumnAdditionChange("b", 1, new ArrayList<CellAtRow>()));
MassChange massChange = new MassChange(changes, false);
massChange.apply(project);
massChange.revert(project);
assertTrue(project.columnModel.columns.isEmpty());
}
Aggregations