Interface ExportProcessor<P>
- Type Parameters:
P
- the business-domain type of the base records this processor is exporting. While the basic filtration and query will only be applied for this domain, the actual exported data can contain other related domains as well
ExportManager
is responsible for most of the coordination during an export, it will
delegate to an ExportProcessor
for performing the actual target
-
specific operations.
Generally speaking, there should be one ExportProcessor
registered for each
Export.target
that needs to be supported.
The ExportManager
will use only the first ExportProcessor
for which
canHandle(Export)
returns true.
- Author:
- Samarth Dhruva (samarthd)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether this processor can support performing the given export operation.generateRows
(List<P> batchToProcess, Export export) Accepts a list of objects - this will be a batch subset of the full results returned inreadRecordsToProcess(Export)
.Returns the exhaustive set of headers that this processor may output values for.readRecordsToProcess
(Export export) Returns the full stream of records from the data store that should be processed.
-
Method Details
-
canHandle
Returns whether this processor can support performing the given export operation. Generally this should be entirely based onExport.target
.- Parameters:
export
- the export that needs to be processed- Returns:
- true if the processor can support performing the export operation, false otherwise
-
getHeaders
LinkedHashSet<String> getHeaders()Returns the exhaustive set of headers that this processor may output values for. These correspond to keys inRowGenerationResponse.getRows()
.This method is called by the
ExportManager
to write all of the headers at the beginning of the file.- Returns:
- the exhaustive set of headers that this processor may output values for
-
readRecordsToProcess
Returns the full stream of records from the data store that should be processed.Implementations should utilize
Export.filterString
,Export.inclusions
, andExport.exclusions
to filter/include results. A reasonable implementation could have the following rules:- If
filterString
is blank andinclusions
is not empty, only the entities specified ininclusions
will be returned (minus anyexclusions
). - If
filterString
is blank andinclusions
is empty, all entities in the data store will be returned (minus anyexclusions
). - If
filterString
is not blank, then all entities matching the filters and any entities specified ininclusions
will be returned (minus anyexclusions
).
- Parameters:
export
- the export that is being processed- Returns:
- a
ReadRecordsResponse
containing the full stream of records from the data store that should be processed, withfilterString
,inclusions
, andexclusions
already accounted for. Results should be narrowed based uponExport.exportingApplicationId
,Export.exportingSandboxId
, andExport.exportingCatalogId
. - See Also:
-
Export.filterString
Export.inclusions
Export.exclusions
- If
-
generateRows
Accepts a list of objects - this will be a batch subset of the full results returned inreadRecordsToProcess(Export)
.For each record in the input, this will generate one or more rows of output that should be written to the file. There may be more than one row of output produced for each record if dependent or related items of that record need to be included in the output.
This method is called multiple times - once for each batch until all records are processed.
- Parameters:
batchToProcess
- a list of records to update and persistexport
- the update that is being processed- Returns:
- a response describing whether the processing of the batch succeeded/failed
-