Class CollectedProductJsonArrayToMerchantCenterXMLFileTransformer
java.lang.Object
com.broadleafcommerce.datafeed.service.publisher.file.transformer.AbstractJsonArrayToXMLFileTransformer<CollectedProduct,MerchantCenterXMLProduct>
com.broadleafcommerce.datafeed.feedprovider.google.sftp.publisher.file.CollectedProductJsonArrayToMerchantCenterXMLFileTransformer
- All Implemented Interfaces:
DataFeedFileTransformer,org.springframework.core.Ordered
public class CollectedProductJsonArrayToMerchantCenterXMLFileTransformer
extends AbstractJsonArrayToXMLFileTransformer<CollectedProduct,MerchantCenterXMLProduct>
implements DataFeedFileTransformer
DataFeedFileTransformer for transforming a source JSON array of CollectedProduct
into an XML containing MerchantCenterXMLProduct entries.
This should follow Google-specific XML requirements as discussed in Google documentation
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionCollectedProductJsonArrayToMerchantCenterXMLFileTransformer(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, DataFeedElementTransformer<CollectedProduct, MerchantCenterXMLProduct> elementTransformer, int maxSourceElementsToReadInBatch) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(DataFeedPublishRequestDetails requestDetails) Reports whether this component can handle processing a file transformation for the givenDataFeedPublishRequestDetails.createLocalOutputFile(DataFeedPublishRequestDetails publishRequest) This follows the naming conventions described by Google.protected voidwritePostDefinition(BufferedWriter bufferedWriter, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper, AbstractFileFeedPublisher.FilePublishContext filePublishContext) This is a hook point allowing implementations to write anything to the output file after the main elements are serialized.protected voidwritePreDefinition(BufferedWriter bufferedWriter, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper, AbstractFileFeedPublisher.FilePublishContext filePublishContext) This is a hook point allowing implementations to write anything to the output file before the main elements are serialized.Methods inherited from class com.broadleafcommerce.datafeed.service.publisher.file.transformer.AbstractJsonArrayToXMLFileTransformer
buildFailedResponse, buildSuccessResponse, buildXMLMapper, getElementTransformer, getMaxSourceElementsToReadInBatch, getObjectMapper, getTypeFactory, transformMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.datafeed.service.publisher.file.transformer.DataFeedFileTransformer
getOrder, transform
-
Constructor Details
-
CollectedProductJsonArrayToMerchantCenterXMLFileTransformer
public CollectedProductJsonArrayToMerchantCenterXMLFileTransformer(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, DataFeedElementTransformer<CollectedProduct, MerchantCenterXMLProduct> elementTransformer, int maxSourceElementsToReadInBatch)
-
-
Method Details
-
canHandle
Description copied from interface:DataFeedFileTransformerReports whether this component can handle processing a file transformation for the givenDataFeedPublishRequestDetails.- Specified by:
canHandlein interfaceDataFeedFileTransformer- Parameters:
requestDetails- request details around the publish process- Returns:
- true if this component can handle the transformation for the given file, false otherwise
-
createLocalOutputFile
This follows the naming conventions described by Google.- Specified by:
createLocalOutputFilein interfaceDataFeedFileTransformer- Parameters:
publishRequest- the publish request details- Returns:
- the newly created temporary output file inside temporary directory
- Throws:
Exception- if something went wrong- See Also:
-
writePreDefinition
protected void writePreDefinition(BufferedWriter bufferedWriter, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper, AbstractFileFeedPublisher.FilePublishContext filePublishContext) throws IOException Description copied from class:AbstractJsonArrayToXMLFileTransformerThis is a hook point allowing implementations to write anything to the output file before the main elements are serialized. For example, an implementation could use this method to write an XML declaration and any desired tags.- Specified by:
writePreDefinitionin classAbstractJsonArrayToXMLFileTransformer<CollectedProduct,MerchantCenterXMLProduct> - Parameters:
bufferedWriter- a buffered writer for writing to the file. Implementations MUST NOT CLOSE this writer. Opening/closing this writer is already handled by the calling method.xmlMapper- the configured XML mapper for XML-POJO transformationfilePublishContext- details around the file publish process- Throws:
IOException- if there was an I/O issue
-
writePostDefinition
protected void writePostDefinition(BufferedWriter bufferedWriter, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper, AbstractFileFeedPublisher.FilePublishContext filePublishContext) throws IOException Description copied from class:AbstractJsonArrayToXMLFileTransformerThis is a hook point allowing implementations to write anything to the output file after the main elements are serialized. For example, an implementation could use this method to close any tags that were previously written inAbstractJsonArrayToXMLFileTransformer.writePreDefinition(BufferedWriter, XmlMapper, FilePublishContext).- Specified by:
writePostDefinitionin classAbstractJsonArrayToXMLFileTransformer<CollectedProduct,MerchantCenterXMLProduct> - Parameters:
bufferedWriter- a buffered writer for writing to the file. Implementations MUST NOT CLOSE this writer. Opening/closing this writer is already handled by the calling method.xmlMapper- the configured XML mapper for XML-POJO transformationfilePublishContext- details around the file publish process- Throws:
IOException- if there was an I/O issue
-