Class AbstractExportRowConverter<S>
- java.lang.Object
-
- com.broadleafcommerce.common.dataexport.service.specification.AbstractExportRowConverter<S>
-
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<S,Map<String,String>>
public abstract class AbstractExportRowConverter<S> extends Object implements org.springframework.core.convert.converter.Converter<S,Map<String,String>>
The base class that is used to convert from given value to aMaprow representation. It usesExportSpecificationto convert only certain fields.Example usage:
public class EntityExportRowConverter extends AbstractExportRowConverter
{ public EntityExportRowConverter(ExportSpecification specification, ObjectMapper baseMapper) { super(specification, baseMapper); } @Overridepublic Mapconvert(Entity source) { return getMapper().convertValue(source, new TypeReference - Author:
- Dima Myroniuk (dmyroniuk)
-
-
Constructor Summary
Constructors Constructor Description AbstractExportRowConverter(ExportSpecification specification, com.fasterxml.jackson.databind.ObjectMapper baseMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.fasterxml.jackson.databind.ObjectMapperconfigureMapper(ExportSpecification specification, com.fasterxml.jackson.databind.ObjectMapper mapper)Map<String,String>convertAndNormalize(S source, Export export)Converts the given entity to aMaprow representation, then executes normalization on the result using all of theExportDataNormalizersconfigured inExportSpecification.getExportDataNormalizers().Map<String,String>convertAndNormalize(S source, Export export, Map<String,Object> params)Converts the given entity to aMaprow representation, then executes normalization on the result using all of theExportDataNormalizersconfigured inExportSpecification.getExportDataNormalizers().LinkedHashSet<String>getHeaders()Returns the exhaustive set of headers that specified inExportSpecification.com.fasterxml.jackson.databind.ObjectMappergetMapper()ExportSpecificationgetSpecification()protected com.fasterxml.jackson.databind.module.SimpleModulegetSpecificationExportModule(ExportSpecification specification)protected voidnormalizeExportDataRow(Map<String,String> row, Export export, Map<String,Object> params)
-
-
-
Constructor Detail
-
AbstractExportRowConverter
public AbstractExportRowConverter(ExportSpecification specification, com.fasterxml.jackson.databind.ObjectMapper baseMapper)
-
-
Method Detail
-
getHeaders
public LinkedHashSet<String> getHeaders()
Returns the exhaustive set of headers that specified inExportSpecification.- Returns:
- the exhaustive set of headers
- See Also:
ExportSpecification.getHeaders()
-
convertAndNormalize
public Map<String,String> convertAndNormalize(S source, Export export)
Converts the given entity to aMaprow representation, then executes normalization on the result using all of theExportDataNormalizersconfigured inExportSpecification.getExportDataNormalizers().- Parameters:
source- the entity to convertexport- the export being processed. Will be supplied to eachExportDataNormalizer.- Returns:
- the
sourceconverted to a normalized row representation - See Also:
ExportSpecification.getExportDataNormalizers()
-
convertAndNormalize
public Map<String,String> convertAndNormalize(S source, Export export, @Nullable Map<String,Object> params)
Converts the given entity to aMaprow representation, then executes normalization on the result using all of theExportDataNormalizersconfigured inExportSpecification.getExportDataNormalizers().- Parameters:
source- the entity to convertexport- the export being processed. Will be supplied to eachExportDataNormalizer.params- (optional) a map of additional parameters that will be supplied to eachExportDataNormalizer- Returns:
- the
sourceconverted to a normalized row representation - See Also:
ExportSpecification.getExportDataNormalizers()
-
normalizeExportDataRow
protected void normalizeExportDataRow(Map<String,String> row, Export export, @Nullable Map<String,Object> params)
-
configureMapper
protected com.fasterxml.jackson.databind.ObjectMapper configureMapper(ExportSpecification specification, com.fasterxml.jackson.databind.ObjectMapper mapper)
-
getSpecificationExportModule
protected com.fasterxml.jackson.databind.module.SimpleModule getSpecificationExportModule(ExportSpecification specification)
-
getMapper
public com.fasterxml.jackson.databind.ObjectMapper getMapper()
-
getSpecification
public ExportSpecification getSpecification()
-
-