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 that needs to be supported.

    The ExportManager will use only the first ExportProcessor for which canHandle(Export) returns true.

    Samarth Dhruva (samarthd)
    See Also:
    • Method Detail

      • canHandle

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

        the exhaustive set of headers that this processor may output values for
      • 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.

        batchToProcess - a list of records to update and persist
        export - the update that is being processed
        a response describing whether the processing of the batch succeeded/failed