Marketing ID duplicate check
This commit is contained in:
@@ -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 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 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 assetPath = "D:\\ToolboxLogosAndTags";
|
||||||
// private static String videoPath = "D:\\Toolbox\\Movies\\";
|
// private static String videoPath = "D:\\Toolbox\\Movies\\";
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ import com.univocity.parsers.csv.CsvWriterSettings;
|
|||||||
public class ToolboxImportFileGenerator {
|
public class ToolboxImportFileGenerator {
|
||||||
private static Logger log = Logger.getLogger(ToolboxImportFileGenerator.class);
|
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 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-update.log";
|
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";
|
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
|
// 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 String uploadPath = "/Resources/Upload/ToolboxLogosAndTags";
|
||||||
|
|
||||||
private static final Map<String, String> brandMap;
|
private static final Map<String, String> brandMap;
|
||||||
@@ -981,6 +981,8 @@ public class ToolboxImportFileGenerator {
|
|||||||
private SimpleDateFormat inputDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
private SimpleDateFormat inputDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
private SimpleDateFormat outputDateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
private SimpleDateFormat outputDateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
||||||
|
|
||||||
|
private HashSet<String> marketingIDs = new HashSet<String>();
|
||||||
|
|
||||||
public ToolboxImportFileGenerator() throws Exception {
|
public ToolboxImportFileGenerator() throws Exception {
|
||||||
parserSettings.getFormat().setLineSeparator("\r\n");
|
parserSettings.getFormat().setLineSeparator("\r\n");
|
||||||
parserSettings.getFormat().setDelimiter(';');
|
parserSettings.getFormat().setDelimiter(';');
|
||||||
@@ -1071,6 +1073,17 @@ public class ToolboxImportFileGenerator {
|
|||||||
asset.byr_cs_country = "United States";
|
asset.byr_cs_country = "United States";
|
||||||
|
|
||||||
asset.byr_MarketingId = line[3];
|
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]);
|
// asset.fileSize = Long.parseLong(line[15]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user