Class InMemoryDataHolder
java.lang.Object
com.riadalabs.jira.plugins.insight.services.imports.common.external.InMemoryDataHolder
- All Implemented Interfaces:
ImportDataHolder
A simple import data holder that keeps all external data in memory before importing it
- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescriptionasPrintableString
(boolean includeData) static ImportDataHolder
createInMemoryDataHolder
(List<DataEntry> dataEntries) Creates a simple in memory import data holder.static ImportDataHolder
No data found and the import should not consider this as a result since the import can complete but the user does not expect any data to be importedstatic ImportDataHolder
createWithParseResult
(List<DataEntry> dataEntries, ExternalDataParseResult externalDataParseResult) Create an inMemoryDataHolder with an external data parse result message.static ImportDataHolder
createWithWarning
(List<DataEntry> dataEntries, String warningMessage) Create an inMemoryDataHolder with warning message.boolean
Used to indicate if data exist to import.boolean
hasNext()
Return true if a call to nextEntry will return more data.Reads an object entry.int
Returns the number of entries that this data holder containsWas all external data parsed?
-
Method Details
-
createInMemoryDataHolder
Creates a simple in memory import data holder. The supplied list will be copied and used internally. The argument should be cleared by the creator after a call to this method in order to preserve memory -
createWithWarning
public static ImportDataHolder createWithWarning(List<DataEntry> dataEntries, String warningMessage) Create an inMemoryDataHolder with warning message. E.g. one of multiple files was not parseable. The parsed files can be imported but the data could differ from the expected from a user perspective -
createWithParseResult
public static ImportDataHolder createWithParseResult(List<DataEntry> dataEntries, ExternalDataParseResult externalDataParseResult) Create an inMemoryDataHolder with an external data parse result message. E.g. one of multiple files was not parseable. The parsed files can be imported but the data could differ from the expected from a user perspective -
createNoDataToImport
No data found and the import should not consider this as a result since the import can complete but the user does not expect any data to be imported -
asPrintableString
- Specified by:
asPrintableString
in interfaceImportDataHolder
-
hasNext
public boolean hasNext()Description copied from interface:ImportDataHolder
Return true if a call to nextEntry will return more data. Returns false when all data has been read- Specified by:
hasNext
in interfaceImportDataHolder
-
nextEntry
Description copied from interface:ImportDataHolder
Reads an object entry. Returns a list of strings that represents the data read from the external source. The list should contain all information required to create one object. I.e. all the relevant attributes represented by the data locators should be present. E.g. in the CSV file this will be one row in the file.- Specified by:
nextEntry
in interfaceImportDataHolder
- Returns:
- the next entry to be handled. Can return
null
to indicate that all data has been processed. An empty list will be treated as end of data and no more data will be read (the same as with null)
-
numberOfEntries
public int numberOfEntries()Description copied from interface:ImportDataHolder
Returns the number of entries that this data holder contains- Specified by:
numberOfEntries
in interfaceImportDataHolder
-
dataToImport
public boolean dataToImport()Description copied from interface:ImportDataHolder
Used to indicate if data exist to import. Notice that there is a difference between numberOfEntries != 0 and dataToImport = false. If dataToImport is false the handling of missing objects will be ignored but if the dataToImport is true and numberOfEntries = 0 all objects will be considered as missing objects and handled accordingly- Specified by:
dataToImport
in interfaceImportDataHolder
-
parsedResult
Description copied from interface:ImportDataHolder
Was all external data parsed? This is a way to inform the import that the data holder may not be complete. A way for the import module to indicate that something is wrong but the error is minor and the import can continue anyway- Specified by:
parsedResult
in interfaceImportDataHolder
- Returns:
- the ExternalDataParseResult
-