Package org.openrefine.model.changes
Interface ChangeData<T>
-
- Type Parameters:
T
- the type of data to store for each row. It should be serializable with Jackson.
- All Superinterfaces:
CloseableIterable<IndexedData<T>>
- All Known Implementing Classes:
LocalChangeData
,LoggedChangeData
,TestingChangeData
public interface ChangeData<T> extends CloseableIterable<IndexedData<T>>
Some external data, obtained by communicating with an external service or performing an expensive computation whose result should be persisted in the project data.This data is indexed by row ids from the original grid it was computed from, making it easy to join both to obtain the final state of the grid after this expensive computation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openrefine.util.CloseableIterable
CloseableIterable.Wrapper<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IndexedData<T>
get(long rowId)
Returns the change data at a given row.Runner
getRunner()
The runner which was used to create this change data.boolean
isComplete()
Whether the entire change data is available to be iterated on statically, without performing any new computation or fetching.void
saveToFile(File file, ChangeDataSerializer<T> serializer)
Saves the change data to a specified directory, following OpenRefine's format for change data.ProgressingFuture<Void>
saveToFileAsync(File file, ChangeDataSerializer<T> serializer)
Saves the change data to a specified directory, following OpenRefine's format for change data, in an asynchronous way.
-
-
-
Method Detail
-
get
IndexedData<T> get(long rowId)
Returns the change data at a given row. The data encapsulated in thisIndexedData
may be null, but not the return value of this function itself.- Parameters:
rowId
- the 0-based row index
-
getRunner
Runner getRunner()
The runner which was used to create this change data.
-
saveToFile
void saveToFile(File file, ChangeDataSerializer<T> serializer) throws IOException, InterruptedException
Saves the change data to a specified directory, following OpenRefine's format for change data.- Parameters:
file
- the directory where to save the gridserializer
- the serializer used to convert the items to strings- Throws:
IOException
InterruptedException
-
saveToFileAsync
ProgressingFuture<Void> saveToFileAsync(File file, ChangeDataSerializer<T> serializer)
Saves the change data to a specified directory, following OpenRefine's format for change data, in an asynchronous way.- Parameters:
file
- the directory where to save the gridserializer
- the serializer used to convert the items to strings- Returns:
- a future which completes once the save is complete
-
isComplete
boolean isComplete()
Whether the entire change data is available to be iterated on statically, without performing any new computation or fetching. This happens when this ChangeData object is loaded back from disk and a suitable completion marker was found.
-
-