Class DefaultDataGeneratorOperation

    • Constructor Detail

      • DefaultDataGeneratorOperation

        public DefaultDataGeneratorOperation()
    • 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.IllegalArgumentException
        Description copied from interface: DataGeneratorOperation
        Generates a line of data that can be then written using a CSVWriter object. The data is generated from a MappingModel object which contains the mapping between data in a source CSV file and an item's attributes discriptors.
        Specified by:
        generateDataLineForMappingModel in interface DataGeneratorOperation
        Parameters:
        inputDataLine - - A line of data read using a CSVWriter.
        mappingModel - - A MappingModel object (Source Data - Target Attribute Data) used to generate the data returned.
        operationState - - A GeneratorOperationState object used to hold the sate of the data generation process.
        Returns:
        A Map containing data that can be used to write to a CSVWriter. See CSVReader.parseLine(String) how the map looks like.
        Throws:
        java.lang.IllegalArgumentException - - if inputDataLine, mappingModel, operationState is 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:
        generateDataLineForAtomicEntry in interface DataGeneratorOperation
        Parameters:
        inputDataLine - - A line of data read using a CSVWriter.
        mappingLineModel - - A MappingLineModel object (Source Data - Target Attribute Data) used to generate the data returned.
        Returns:
        A String object containing a line of data that can be appended to a Map containing data that can be used to write to a CSVWriter. See CSVReader.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:
        generateDataLineForProductAttribEntry in interface DataGeneratorOperation
        Parameters:
        inputDataLine - - A line of data read using a CSVWriter.
        mappingLineModel - - A MappingLineModel object (Source Data - Target Attribute Data) used to generate the data returned.
        Returns:
        A String object containing a line of data that can be appended to a Map containing data that can be used to write to a CSVWriter. See CSVReader.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:
        generateDataLineForComposedEntry in interface DataGeneratorOperation
        Parameters:
        inputDataLine - - A line of data read using a CSVWriter.
        mappingLineModel - - A MappingLineModel object (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 - - A GeneratorOperationState object used to hold the sate of the data generation process.
        Returns:
        A String object containing a line of data that can be appended to a Map containing data that can be used to write to a CSVWriter. See CSVReader.parseLine(String) how the map looks like.
        Throws:
        java.lang.IllegalArgumentException - - if inputDataLine, mappingModel, operationState is 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 given MappingLineModel object and its children (MappingLineModel objects). The data generated for each line depends on the attribute type that the MappingLineModel object represents.
        Parameters:
        inputDataLine - a non null Map object containing a line read using CSVReader.getLine().
        mappingLineModel - a non null MappingLineModel object.
        forMainDataFile - a boolean flag 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 non null GeneratorOperationState object used to hold data which needs to persist during the generation process.
        Returns:
        outputLine a Map object. 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 given MappingLineModel object and its children (MappingLineModel objects). The data generated for each line depends on the attribute type that the MappingLineModel object 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 non null Map object containing a line read using CSVReader.getLine().
        mappingLineModel - a non null MappingLineModel object.
        forMainDataFile - a boolean flag 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 non null GeneratorOperationState object used to hold data which needs to persist during the generation process.
        Returns:
        outputBuffer a String object 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)