Marketing ID duplicate check

This commit is contained in:
GEXCE
2017-09-01 21:00:57 +02:00
parent 6adc260224
commit 1f6a7a48cd
2 changed files with 17 additions and 4 deletions
@@ -43,7 +43,7 @@ public class CropAssetCopyTool {
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration.csv";
private static String toolboxExportUpdateFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration-update.csv";
private static String toolboxExportUpdateFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration.copytool.csv";
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration.copytool.log";
private static String assetPath = "D:\\ToolboxLogosAndTags";
// private static String videoPath = "D:\\Toolbox\\Movies\\";
@@ -29,12 +29,12 @@ import com.univocity.parsers.csv.CsvWriterSettings;
public class ToolboxImportFileGenerator {
private static Logger log = Logger.getLogger(ToolboxImportFileGenerator.class);
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration-update.csv";
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration-update.log";
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration.copytool.csv";
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration.copytool.generator.log";
private static String licenseGuidsFilePath = "C:\\Temp\\Migration CS - SQL Server\\Release_GUIDs.csv";
// XXX Spreadsheet needs be be named "Records" in Excel for the importer
private static String importFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration-update-IMPORT.csv";
private static String importFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-28 - logos and tags not included in first migration.copytool.generator.csv";
private static String uploadPath = "/Resources/Upload/ToolboxLogosAndTags";
private static final Map<String, String> brandMap;
@@ -980,6 +980,8 @@ public class ToolboxImportFileGenerator {
private SimpleDateFormat inputDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
private SimpleDateFormat outputDateFormat = new SimpleDateFormat("MM/dd/yyyy");
private HashSet<String> marketingIDs = new HashSet<String>();
public ToolboxImportFileGenerator() throws Exception {
parserSettings.getFormat().setLineSeparator("\r\n");
@@ -1071,6 +1073,17 @@ public class ToolboxImportFileGenerator {
asset.byr_cs_country = "United States";
asset.byr_MarketingId = line[3];
if (!marketingIDs.add(asset.byr_MarketingId)) {
CropScienceAsset assetWithMarketingID = null;
for (CropScienceAsset ast : assets.values()) {
if (ast.byr_MarketingId.equals(asset.byr_MarketingId)) {
assetWithMarketingID = ast;
break;
}
}
log.error(asset.toolboxAssetId + ", line " + lineNo + ": marketing ID " + asset.byr_MarketingId + " already bound to asset " + assetWithMarketingID.toolboxAssetId);
}
// asset.fileSize = Long.parseLong(line[15]);