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>
While 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 Details

    • canHandle

      boolean canHandle(Export export)
      Returns whether this processor can support performing the given export operation. Generally this should be entirely based on Export.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 in RowGenerationResponse.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

      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, and Export.exclusions to filter/include results. A reasonable implementation could have the following rules:

      • If filterString is blank and inclusions is not empty, only the entities specified in inclusions will be returned (minus any exclusions).
      • If filterString is blank and inclusions is empty, all entities in the data store will be returned (minus any exclusions).
      • If filterString is not blank, then all entities matching the filters and any entities specified in inclusions will be returned (minus any exclusions).
      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, with filterString, inclusions, and exclusions already accounted for. Results should be narrowed based upon Export.exportingApplicationId, Export.exportingSandboxId, and Export.exportingCatalogId.
      See Also:
      • Export.filterString
      • Export.inclusions
      • Export.exclusions
    • generateRows

      RowGenerationResponse generateRows(List<P> batchToProcess, Export export)
      Accepts a list of objects - this will be a batch subset of the full results returned in readRecordsToProcess(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 persist
      export - the update that is being processed
      Returns:
      a response describing whether the processing of the batch succeeded/failed