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:
    ExportManager
    • 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.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
      • 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