import com.broadleafcommerce.catalog.dataexport.converter.DimensionsExportRowConverter;
import com.broadleafcommerce.catalog.dataexport.converter.ProductExportRowConverter;
import com.broadleafcommerce.catalog.dataexport.converter.ToStringConverter;
import com.broadleafcommerce.catalog.dataexport.converter.WeightExportRowConverter;
import com.broadleafcommerce.catalog.dataexport.converter.support.ConversionUtils;
import com.broadleafcommerce.catalog.dataexport.specification.ProductExportSpecification;
import com.broadleafcommerce.catalog.domain.product.Product;
import com.broadleafsamples.tutorials.services.catalog.provider.jpa.domain.TutorialJpaProduct;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.LinkedHashSet;
import java.util.Map;
import static com.broadleafcommerce.common.extension.reflection.InvocationUtils.withExample;
public class MyProductExportRowConverter extends ProductExportRowConverter {
public MyProductExportRowConverter(ProductExportSpecification specification,
ObjectMapper objectMapper,
ToStringConverter<Object> toStringConverter,
DimensionsExportRowConverter dimensionsExportRowConverter,
WeightExportRowConverter weightExportRowConverter) {
super(specification, objectMapper, toStringConverter, dimensionsExportRowConverter, weightExportRowConverter);
}
@Override
public LinkedHashSet<String> getHeaders() {
LinkedHashSet<String> headers = super.getHeaders();
headers.add(MyFields.LINE_CODE);
return headers;
}
@Override
public Map<String, String> convert(Product source) {
Map<String, String> result = super.convert(source);
ConversionUtils.putIfNotNull(MyFields.LINE_CODE,
((MyProduct)source).getLineCode(), result);
return result;
}
public static class MyFields {
public static final String LINE_CODE = "lineCode";
public static final String CARE_INSTRUCTIONS = "careInstructions";
}
}