Search in sources :

Example 11 with FilteredRows

use of com.google.refine.browsing.FilteredRows in project OpenRefine by OpenRefine.

the class EngineDependentMassCellOperation method createHistoryEntry.

@Override
protected HistoryEntry createHistoryEntry(Project project, long historyEntryID) throws Exception {
    Engine engine = createEngine(project);
    Column column = project.columnModel.getColumnByName(_columnName);
    if (column == null) {
        throw new Exception("No column named " + _columnName);
    }
    List<CellChange> cellChanges = new ArrayList<CellChange>(project.rows.size());
    FilteredRows filteredRows = engine.getAllFilteredRows();
    try {
        filteredRows.accept(project, createRowVisitor(project, cellChanges, historyEntryID));
    } catch (Exception e) {
        e.printStackTrace();
    }
    String description = createDescription(column, cellChanges);
    return new HistoryEntry(historyEntryID, project, description, this, createChange(project, column, cellChanges));
}
Also used : Column(com.google.refine.model.Column) CellChange(com.google.refine.model.changes.CellChange) MassCellChange(com.google.refine.model.changes.MassCellChange) ArrayList(java.util.ArrayList) HistoryEntry(com.google.refine.history.HistoryEntry) FilteredRows(com.google.refine.browsing.FilteredRows) Engine(com.google.refine.browsing.Engine)

Example 12 with FilteredRows

use of com.google.refine.browsing.FilteredRows in project OpenRefine by OpenRefine.

the class RowRemovalOperation method createHistoryEntry.

@Override
protected HistoryEntry createHistoryEntry(Project project, long historyEntryID) throws Exception {
    Engine engine = createEngine(project);
    List<Integer> rowIndices = new ArrayList<Integer>();
    FilteredRows filteredRows = engine.getAllFilteredRows();
    filteredRows.accept(project, createRowVisitor(project, rowIndices));
    return new HistoryEntry(historyEntryID, project, "Remove " + rowIndices.size() + " rows", this, new RowRemovalChange(rowIndices));
}
Also used : RowRemovalChange(com.google.refine.model.changes.RowRemovalChange) ArrayList(java.util.ArrayList) HistoryEntry(com.google.refine.history.HistoryEntry) FilteredRows(com.google.refine.browsing.FilteredRows) Engine(com.google.refine.browsing.Engine)

Example 13 with FilteredRows

use of com.google.refine.browsing.FilteredRows 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));
}
Also used : MassChange(com.google.refine.model.changes.MassChange) ArrayList(java.util.ArrayList) HistoryEntry(com.google.refine.history.HistoryEntry) RowStarChange(com.google.refine.model.changes.RowStarChange) Change(com.google.refine.history.Change) MassChange(com.google.refine.model.changes.MassChange) FilteredRows(com.google.refine.browsing.FilteredRows) Engine(com.google.refine.browsing.Engine)

Aggregations

FilteredRows (com.google.refine.browsing.FilteredRows)13 Engine (com.google.refine.browsing.Engine)8 ArrayList (java.util.ArrayList)8 HistoryEntry (com.google.refine.history.HistoryEntry)7 Column (com.google.refine.model.Column)6 JSONException (org.json.JSONException)6 RowVisitor (com.google.refine.browsing.RowVisitor)5 Change (com.google.refine.history.Change)4 JSONObject (org.json.JSONObject)4 Project (com.google.refine.model.Project)3 MassChange (com.google.refine.model.changes.MassChange)3 HashMap (java.util.HashMap)3 FilteredRecords (com.google.refine.browsing.FilteredRecords)2 RecordVisitor (com.google.refine.browsing.RecordVisitor)2 ParsingException (com.google.refine.expr.ParsingException)2 Row (com.google.refine.model.Row)2 CellChange (com.google.refine.model.changes.CellChange)2 SortingRecordVisitor (com.google.refine.sorting.SortingRecordVisitor)2 SortingRowVisitor (com.google.refine.sorting.SortingRowVisitor)2 IOException (java.io.IOException)2