Class DefaultDataGeneratorOperation
- java.lang.Object
-
- de.hybris.platform.importcockpit.services.impex.generator.operations.impl.AbstractImpexGeneratorOperation
-
- de.hybris.platform.importcockpit.services.impex.generator.operations.impl.DefaultDataGeneratorOperation
-
- All Implemented Interfaces:
DataGeneratorOperation,ImpexGeneratorOperation
public class DefaultDataGeneratorOperation extends AbstractImpexGeneratorOperation implements DataGeneratorOperation
-
-
Constructor Summary
Constructors Constructor Description DefaultDataGeneratorOperation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgenerateDataLineForAtomicEntry(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel)java.lang.StringgenerateDataLineForComposedEntry(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel, boolean forMainDataFile, GeneratorOperationState operationState)protected java.lang.StringgenerateDataLineForComposedTypeMappingLine(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel, boolean forMainDataFile, GeneratorOperationState operationState)Generates a data line for a givenMappingLineModelobject and its children (MappingLineModelobjects).protected java.util.Map<java.lang.Integer,java.lang.String>generateDataLineForMappingLineModel(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel, boolean forMainDataFile, GeneratorOperationState operationState)Generates a data line for a givenMappingLineModelobject and its children (MappingLineModelobjects).java.util.Map<java.lang.Integer,java.lang.String>generateDataLineForMappingModel(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingModel mappingModel, GeneratorOperationState operationState)Generates a line of data that can be then written using aCSVWriterobject.java.lang.StringgenerateDataLineForProductAttribEntry(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel)protected java.lang.StringgetGeneratedDocIDReference(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLine, GeneratorOperationState operationState)Generates a Document ID for a mapping line if it represents a PartOf Attribute (e.g.voidsetFormatBuilder(FormatBuilder formatBuilder)-
Methods inherited from class de.hybris.platform.importcockpit.services.impex.generator.operations.impl.AbstractImpexGeneratorOperation
appendCatalogVersionDetailsForAttributeReference, appendOwner, apppendTranslatorForProductAttrib, getCatalogTypeService, getCatalogVersionsForMapping, getGeneratedDocIDReference, getHaveUniqueAttributes, getMappingLineService, getMappingService, getVersionForMappingLine, hasMappedSource, hasMappedSources, isCatalogItem, setCatalogTypeService, setMappingLineService, setMappingService
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.importcockpit.services.impex.generator.operations.ImpexGeneratorOperation
getCatalogVersionsForMapping, getGeneratedDocIDReference, getVersionForMappingLine, hasMappedSources, isCatalogItem
-
-
-
-
Method Detail
-
generateDataLineForMappingModel
public java.util.Map<java.lang.Integer,java.lang.String> generateDataLineForMappingModel(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingModel mappingModel, GeneratorOperationState operationState) throws java.lang.IllegalArgumentExceptionDescription copied from interface:DataGeneratorOperationGenerates a line of data that can be then written using aCSVWriterobject. The data is generated from aMappingModelobject which contains the mapping between data in a source CSV file and an item's attributes discriptors.- Specified by:
generateDataLineForMappingModelin interfaceDataGeneratorOperation- Parameters:
inputDataLine- - A line of data read using aCSVWriter.mappingModel- - AMappingModelobject (Source Data - Target Attribute Data) used to generate the data returned.operationState- - AGeneratorOperationStateobject used to hold the sate of the data generation process.- Returns:
- A
Mapcontaining data that can be used to write to aCSVWriter. SeeCSVReader.parseLine(String)how the map looks like. - Throws:
java.lang.IllegalArgumentException- - ifinputDataLine, mappingModel, operationStateis not set to valid data.
-
generateDataLineForAtomicEntry
public java.lang.String generateDataLineForAtomicEntry(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel)- Specified by:
generateDataLineForAtomicEntryin interfaceDataGeneratorOperation- Parameters:
inputDataLine- - A line of data read using aCSVWriter.mappingLineModel- - AMappingLineModelobject (Source Data - Target Attribute Data) used to generate the data returned.- Returns:
- A
Stringobject containing a line of data that can be appended to aMapcontaining data that can be used to write to aCSVWriter. SeeCSVReader.parseLine(String)how the map looks like.
-
generateDataLineForProductAttribEntry
public java.lang.String generateDataLineForProductAttribEntry(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel)- Specified by:
generateDataLineForProductAttribEntryin interfaceDataGeneratorOperation- Parameters:
inputDataLine- - A line of data read using aCSVWriter.mappingLineModel- - AMappingLineModelobject (Source Data - Target Attribute Data) used to generate the data returned.- Returns:
- A
Stringobject containing a line of data that can be appended to aMapcontaining data that can be used to write to aCSVWriter. SeeCSVReader.parseLine(String)how the map looks like.
-
generateDataLineForComposedEntry
public java.lang.String generateDataLineForComposedEntry(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel, boolean forMainDataFile, GeneratorOperationState operationState) throws java.lang.IllegalArgumentException- Specified by:
generateDataLineForComposedEntryin interfaceDataGeneratorOperation- Parameters:
inputDataLine- - A line of data read using aCSVWriter.mappingLineModel- - AMappingLineModelobject (Source Data - Target Attribute Data) used to generate the data returned.forMainDataFile- - A boolean flag which indicates if the data generated is for the Main CSV file for import or a generated file (e.g. when composed attributes are generated) that will be a part if the import medias.operationState- - AGeneratorOperationStateobject used to hold the sate of the data generation process.- Returns:
- A
Stringobject containing a line of data that can be appended to aMapcontaining data that can be used to write to aCSVWriter. SeeCSVReader.parseLine(String)how the map looks like. - Throws:
java.lang.IllegalArgumentException- - ifinputDataLine, mappingModel, operationStateis not set to valid data.
-
generateDataLineForMappingLineModel
protected java.util.Map<java.lang.Integer,java.lang.String> generateDataLineForMappingLineModel(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel, boolean forMainDataFile, GeneratorOperationState operationState)Generates a data line for a givenMappingLineModelobject and its children (MappingLineModelobjects). The data generated for each line depends on the attribute type that theMappingLineModelobject represents.- Parameters:
inputDataLine- a nonnullMapobject containing a line read usingCSVReader.getLine().mappingLineModel- a nonnullMappingLineModelobject.forMainDataFile- abooleanflag that indicates to the data generator if the resultant data will be used for the main file attached to the cron job or the additional file.operationState- a nonnullGeneratorOperationStateobject used to hold data which needs to persist during the generation process.- Returns:
- outputLine a
Mapobject. where[key, value] = [field (column index), data value]
-
generateDataLineForComposedTypeMappingLine
protected java.lang.String generateDataLineForComposedTypeMappingLine(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLineModel, boolean forMainDataFile, GeneratorOperationState operationState)Generates a data line for a givenMappingLineModelobject and its children (MappingLineModelobjects). The data generated for each line depends on the attribute type that theMappingLineModelobject represents. for children of composed types Appends the catalog version details if the mapping line is catalog version aware to the ImpexHeaderAttributeReference output.- Parameters:
inputDataLine- a nonnullMapobject containing a line read usingCSVReader.getLine().mappingLineModel- a nonnullMappingLineModelobject.forMainDataFile- abooleanflag that indicates to the data generator if the resultant data will be used for the main file attached to the cron job or the additional file.operationState- a nonnullGeneratorOperationStateobject used to hold data which needs to persist during the generation process.- Returns:
- outputBuffer a
Stringobject representing the data generated.
-
getGeneratedDocIDReference
protected java.lang.String getGeneratedDocIDReference(java.util.Map<java.lang.Integer,java.lang.String> inputDataLine, MappingLineModel mappingLine, GeneratorOperationState operationState)Generates a Document ID for a mapping line if it represents a PartOf Attribute (e.g. Customer.addresses). This is required so the parent attribute (Customer) can reference the partOf attribute (addresses) when doing an import since an import of this type is done as seperate imports (e.g. import addresses first then customer).- Parameters:
inputDataLine- - Used to generate a hashcode that will be part of the generated Document ID.mappingLine- - Used to get the attribute code in combination with a hashcode of the object that will be part of the generated Document ID.operationState- - Used to store the state of all generated Document IDs.- Returns:
- - The generated PartOf reference Document ID.
-
setFormatBuilder
public void setFormatBuilder(FormatBuilder formatBuilder)
-
-