public class DefaultImpExTransformationService extends Object implements ImpExTransformationService
| Constructor and Description |
|---|
DefaultImpExTransformationService() |
| Modifier and Type | Method and Description |
|---|---|
protected DataGeneratorOperation |
getDataGeneratorOperation() |
protected FileGeneratorOperation |
getFileGeneratorOperation() |
protected ImportCockpitMediaService |
getImportCockpitMediaService() |
protected boolean |
hasValidSource(MappingModel mappingModel,
CSVReader csvReader)
Checks if the mapping model for transformation and the CSVReader used to read source in the mapping model is valid.
|
protected boolean |
isValidCsvReadLine(CSVReader csvReader,
int linesToSkip)
Checks if the current
CSVReader line is valid |
void |
setDataGeneratorOperation(DataGeneratorOperation dataGenOperation) |
void |
setFileGeneratorOperation(FileGeneratorOperation fileGenOperation) |
void |
setImportCockpitMediaService(ImportCockpitMediaService importCockpitMediaService) |
Map<String,File> |
transformData(ImportCockpitCronJobModel cronJobModel,
MappingModel mappingModel)
Transforms all the source data (CSV format) stored in a given
ImportCockpitCronJobModel into seperate CSV Data files
based on the MappingModel defined. |
protected void |
writeRocordToCsvFile(CSVWriter csvWriter,
Map<Integer,String> record,
boolean clear)
Writes a record to a CSV file using a CSVWriter.
|
protected ImportCockpitMediaService getImportCockpitMediaService()
public void setImportCockpitMediaService(ImportCockpitMediaService importCockpitMediaService)
protected DataGeneratorOperation getDataGeneratorOperation()
public void setDataGeneratorOperation(DataGeneratorOperation dataGenOperation)
protected FileGeneratorOperation getFileGeneratorOperation()
public void setFileGeneratorOperation(FileGeneratorOperation fileGenOperation)
public Map<String,File> transformData(ImportCockpitCronJobModel cronJobModel, MappingModel mappingModel)
ImpExTransformationServiceImportCockpitCronJobModel into seperate CSV Data files
based on the MappingModel defined.
The CSV files generated consist of the Main CSV file e.g. Product and all "Sub Data" e.g.
europe1Prices,...,.... "Sub Data" here is the data that will be imported on the fly when the user has specified
the CREATE impexImportMode for at least one composed mapped line (MappingLineModel).transformData in interface ImpExTransformationServicecronJobModel - - a ImportCockpitCronJobModel object that ismappingModel - - the MappingModel object which is linked to the source data.unmodifiableMap of all the files generated during the transformation process.protected boolean hasValidSource(MappingModel mappingModel, CSVReader csvReader)
mappingModel - - a MappingModel object.csvReader - - a CSVReader object.protected boolean isValidCsvReadLine(CSVReader csvReader, int linesToSkip)
CSVReader line is validcsvReader - - a CSVReader object.linesToSkip - - number of lines to skip when reading from the csv file.protected void writeRocordToCsvFile(CSVWriter csvWriter, Map<Integer,String> record, boolean clear) throws IOException
csvWriter - - a CSVWriter object used to write CSV data.record - - a Map containing data to be written to the csv file. See CSVReader.parseLine(String) for the
structure of the Map.clear - - a boolean, if true will clear the record Map of all data when the write completes.
Suitable when this is called in a loop.IOException - - error while writing.Copyright © 2017 SAP SE. All Rights Reserved.