Class AbstractJsonArrayToCSVFileTransformer<S,D> 
java.lang.Object
com.broadleafcommerce.datafeed.service.publisher.file.transformer.AbstractJsonArrayToCSVFileTransformer<S,D> 
- Type Parameters:
- S- see- DataFeedElementTransformer.getSourceElementType()
- D- see- DataFeedElementTransformer.getDestinationElementType(). This should contain any CSV serialization configuration details as necessary, since it will be used to build the CSV schema. See- buildCsvSchema(CsvMapper)
- All Implemented Interfaces:
- DataFeedFileTransformer,- org.springframework.core.Ordered
- Direct Known Subclasses:
- CollectedProductJsonArrayToCommerceManagerFeedCSVFileTransformer
public abstract class AbstractJsonArrayToCSVFileTransformer<S,D> 
extends Object
implements DataFeedFileTransformer
Common starting point for a 
DataFeedFileTransformer for transforming a source JSON array
 to a destination CSV.
 
 This is not intended for use as a singleton bean, and each eligible use-case should
 define its own new extension of this type. Due to delegation of actual element
 conversion to DataFeedElementTransformer, this component is fairly generic and multiple
 beans of this type can be declared (with different names) as needed with different element
 transformers.
- 
Field SummaryFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractJsonArrayToCSVFileTransformer(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, DataFeedElementTransformer<S, D> elementTransformer, int maxSourceElementsToReadInBatch) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected com.fasterxml.jackson.dataformat.csv.CsvMapperGenerally sensible defaults for a CSV mapper.protected com.fasterxml.jackson.dataformat.csv.CsvSchemabuildCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvMapper csvMapper) protected DataFeedFileTransformResponseDetailsbuildFailedResponse(List<String> errorDetails) protected DataFeedFileTransformResponseDetailsbuildSuccessResponse(boolean resultShouldBeSubmitted) protected DataFeedElementTransformer<S,D> Delegate for converting source elements into destination elements.protected intLimits the number of elements that are read from the source file at a time.protected com.fasterxml.jackson.databind.ObjectMapperprotected com.broadleafcommerce.common.extension.TypeFactorytransform(AbstractFileFeedPublisher.FilePublishContext publishContext) For reference, see this article on writing CSV with JacksonMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.datafeed.service.publisher.file.transformer.DataFeedFileTransformercanHandle, createLocalOutputFile, getOrder
- 
Constructor Details- 
AbstractJsonArrayToCSVFileTransformerpublic AbstractJsonArrayToCSVFileTransformer(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, DataFeedElementTransformer<S, D> elementTransformer, int maxSourceElementsToReadInBatch) 
 
- 
- 
Method Details- 
transformpublic DataFeedFileTransformResponseDetails transform(AbstractFileFeedPublisher.FilePublishContext publishContext) For reference, see this article on writing CSV with Jackson- Specified by:
- transformin interface- DataFeedFileTransformer
- Parameters:
- publishContext- details around the file publish process
- Returns:
- details about the success/failure of the operation
 
- 
buildCsvMapperprotected com.fasterxml.jackson.dataformat.csv.CsvMapper buildCsvMapper()Generally sensible defaults for a CSV mapper.- Returns:
- the CsvMapper to write with
 
- 
buildCsvSchemaprotected com.fasterxml.jackson.dataformat.csv.CsvSchema buildCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvMapper csvMapper) - Parameters:
- csvMapper- the csvMapper that can be used to help construct this schema
- Returns:
- the CsvSchema to write with
 
- 
buildFailedResponse
- 
buildSuccessResponseprotected DataFeedFileTransformResponseDetails buildSuccessResponse(boolean resultShouldBeSubmitted) 
- 
getObjectMapperprotected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
- 
getTypeFactoryprotected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
- 
getElementTransformerDelegate for converting source elements into destination elements.
- 
getMaxSourceElementsToReadInBatchprotected int getMaxSourceElementsToReadInBatch()Limits the number of elements that are read from the source file at a time.
 
-