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
public interface ExportProcessor<P>WhileExportManageris responsible for most of the coordination during an export, it will delegate to anExportProcessorfor performing the actualtarget- specific operations.Generally speaking, there should be one
ExportProcessorregistered for eachExport.targetthat needs to be supported.The
ExportManagerwill use only the firstExportProcessorfor whichcanHandle(Export)returns true.- Author:
- Samarth Dhruva (samarthd)
- See Also:
ExportManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanHandle(Export export)Returns whether this processor can support performing the given export operation.RowGenerationResponsegenerateRows(List<P> batchToProcess, Export export)Accepts a list of objects - this will be a batch subset of the full results returned inreadRecordsToProcess(Export).LinkedHashSet<String>getHeaders()Returns the exhaustive set of headers that this processor may output values for.ReadRecordsResponse<P>readRecordsToProcess(Export export)Returns the full stream of records from the data store that should be processed.
-
-
-
Method Detail
-
canHandle
boolean canHandle(Export export)
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
ExportManagerto 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
ReadRecordsResponse<P> readRecordsToProcess(Export export)
Returns the full stream of records from the data store that should be processed.Implementations should utilize
Export.filterString,Export.inclusions, andExport.exclusionsto filter/include results. A reasonable implementation could have the following rules:- If
filterStringis blank andinclusionsis not empty, only the entities specified ininclusionswill be returned (minus anyexclusions). - If
filterStringis blank andinclusionsis empty, all entities in the data store will be returned (minus anyexclusions). - If
filterStringis not blank, then all entities matching the filters and any entities specified ininclusionswill be returned (minus anyexclusions).
- Parameters:
export- the export that is being processed- Returns:
- a
ReadRecordsResponsecontaining the full stream of records from the data store that should be processed, withfilterString,inclusions, andexclusionsalready accounted for. Results should be narrowed based uponExport.exportingApplicationId,Export.exportingSandboxId, andExport.exportingCatalogId. - See Also:
Export.filterString,Export.inclusions,Export.exclusions
- If
-
generateRows
RowGenerationResponse generateRows(List<P> batchToProcess, Export export)
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
-
-