Interface ExportRowProducer<P>

Type Parameters:
P - the base domain type for which rows are to be generated
All Known Implementing Classes:
ProductExportRowProducer

public interface ExportRowProducer<P>
Responsible for generating all of the rows necessary to represent domain objects.

Often times in an export, it is desirable to also output rows of related and embedded domain objects of the base domain. This can require the use of multiple different "converters" that each hold the responsibility of performing the conversion for a specific domain.

This "row producer" abstraction is intended to serve as a single dependency that an ExportProcessor can inject to produce the rows rather than injecting each converter individually and aggregating the output manually. If any queries need to be performed for related domains, it performs those too.

Author:
Samarth Dhruva (samarthd)
  • Method Summary

    Modifier and Type
    Method
    Description
    com.broadleafcommerce.common.dataexport.service.RowGenerationResponse
    generateRows(List<P> batch, com.broadleafcommerce.common.dataexport.domain.Export export, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Given a list of base domain objects, will produce all of the rows that are needed to represent them and any desired related/embedded domain objects.
    Returns the exhaustive set of headers that this row producer may output values for.
  • Method Details

    • getHeaders

      LinkedHashSet<String> getHeaders()
      Returns the exhaustive set of headers that this row producer may output values for. These correspond to keys in the RowGenerationResponse.rows produced by #generateRows(List).

      This method is called by the ExportProcessor when it needs to report all of the headers it may possibly output.

      Returns:
      the exhaustive set of headers that this row producer may output values for
    • generateRows

      com.broadleafcommerce.common.dataexport.service.RowGenerationResponse generateRows(List<P> batch, com.broadleafcommerce.common.dataexport.domain.Export export, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Given a list of base domain objects, will produce all of the rows that are needed to represent them and any desired related/embedded domain objects.

      For this reason, the returned list may contain more than one element for each element in the input list.

      If any queries need to be performed to retrieve any of the related domains, they are performed by this method.

      Parameters:
      batch - a list of base domain objects to produce rows for
      export - the export that is being processed
      contextInfo - context information surrounding sandboxing and multitenant state. This should be used to narrow results of any queries that need to be performed to generate the output.
      Returns:
      a response containing a list of row representations of the base domain objects (and any related domain objects). Details about success/failure are also included.