Releasekram

This commit is contained in:
gexce
2017-08-28 17:31:22 +02:00
parent df8727f9b8
commit 1812bdbbaa
3 changed files with 45 additions and 17 deletions
@@ -24,10 +24,14 @@ public class CropScienceAsset {
String byr_cs_IsShouldBePublished;
String byr_cs_warehouseAvailable;
String byr_cs_country;
String byr_licenseScope;
String byr_licenseOwner;
String byr_licenseInformation = "";
HashSet<String> brands = new HashSet<String>();
HashSet<String> indications = new HashSet<String>();
HashSet<String> licenseRecords = new HashSet<String>();
HashSet<String> licenseTypes = new HashSet<String>();
Long fileSize;
@@ -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\\all imported IDs - toolbox export.csv";
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\all imported IDs - toolbox export.log";
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\all imported IDs - toolbox export - TESTSET.csv";
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\all imported IDs - toolbox export - TESTSET.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\\all imported IDs - toolbox export-IMPORT.csv";
private static String importFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\all imported IDs - toolbox export - TESTSET-IMPORT.csv";
private static String uploadPath = "/Resources/Upload/ToolboxMigration";
private static final Map<String, String> brandMap;
@@ -1019,9 +1019,6 @@ public class ToolboxImportFileGenerator {
long assetTypeNull = 0;
long releaseMissing = 0;
// XXX
int mig2 = 0;
for (String[] line : inputRows) {
Integer assetId = Integer.parseInt(line[0]);
@@ -1082,7 +1079,7 @@ public class ToolboxImportFileGenerator {
if (!line[17].equals("NULL"))
asset.byr_cs_retireDate = outputDateFormat.format(inputDateFormat.parse(line[17]));
asset.byr_cs_license_classification = "No License required";
asset.byr_cs_license_classification = "";
asset.byr_campaignYearLabel = line[18];
@@ -1181,6 +1178,25 @@ public class ToolboxImportFileGenerator {
if (!line[34].equals("NULL")) {
if (licenses.containsKey(line[34])) {
asset.licenseRecords.add(licenses.get(line[34]));
if (line[30].equals("1"))
asset.licenseTypes.add("License Agreement");
else if (line[30].equals("2"))
asset.licenseTypes.add("Written permission release");
else if (line[30].equals("3"))
asset.licenseTypes.add("Testimonial release");
else if (line[30].equals("4"))
asset.licenseTypes.add("Location release");
else if (line[30].equals("5"))
asset.licenseTypes.add("Talent/Music release");
asset.byr_licenseScope = "US";
asset.byr_licenseOwner = "Bayer CropScience LP";
if (asset.byr_licenseInformation.length() > 0)
asset.byr_licenseInformation += "\n";
asset.byr_licenseInformation += "License imported from Toolbox. Licensor: " + line[32] + ", Creator/Company: " + line[36] + " " + line[37] + "/" + line[38] + ", Toolbox upload date: " + outputDateFormat.format(inputDateFormat.parse(line[33]));
}
else {
log.error(asset.toolboxAssetId + ", line " + lineNo + ": No GUID for release file " + line[34]);
@@ -1201,7 +1217,6 @@ public class ToolboxImportFileGenerator {
log.info("Release missing: " + releaseMissing);
log.info("No asset type: " + noAssetType);
log.info("Internal assets: " + internalAssets);
log.info("ToolboxMigration2: " + mig2);
}
private void writeImportFile() {
@@ -1225,11 +1240,20 @@ public class ToolboxImportFileGenerator {
licenseRecords += licenseRecord;
}
String licenseTypes = "";
for (String licenseType : asset.licenseTypes) {
if (licenseTypes.length() > 0)
licenseTypes += "\n";
licenseTypes += licenseType;
}
String[] csvLine = new String[] { asset.assetPath, asset.filename, asset.appendClassification, asset.byr_Title,
asset.byr_MarketingId, asset.byr_cs_assetApproval, asset.byr_cs_license_classification, asset.byr_cs_businessUnit,
brands, asset.byr_cs_releaseDate, asset.byr_cs_retireDate, asset.byr_cs_description, asset.byr_cs_keywords_tl,
asset.byr_campaignYearLabel, asset.byr_campaignTitle, asset.byr_cs_IsShouldBePublished,
asset.byr_cs_warehouseAvailable, asset.byr_cs_country, licenseRecords };
asset.byr_campaignYearLabel, asset.byr_campaignTitle, asset.byr_cs_IsShouldBePublished, asset.byr_cs_warehouseAvailable,
asset.byr_cs_country, licenseRecords, licenseTypes, asset.byr_licenseScope, asset.byr_licenseOwner,
asset.byr_licenseInformation };
csvOutputList.add(csvLine);
}
@@ -1241,7 +1265,8 @@ public class ToolboxImportFileGenerator {
"fields|byr_cs_assetApproval", "fields|byr_cs_licenseType", "fields|byr_cs_businessUnit", "fields|byr_cs_brand",
"fields|byr_cs_releaseDate", "fields|byr_cs_retireDate", "fields|byr_cs_Description", "fields|byr_cs_keywords_tl",
"fields|byr_campaignYearLabel", "fields|byr_campaignTitleLabel", "fields|byr_cs_IsShouldBePublished",
"fields|byr_cs_warehouseAvailable", "fields|byr_cs_country", "fields|byr_cs_licenseRecord");
"fields|byr_cs_warehouseAvailable", "fields|byr_cs_country", "fields|byr_cs_licenseRecord", "fields|byr_cs_licenseType",
"fields|byr_licenseScope", "fields|byr_licenseOwner", "fields|byr_licenseInformation");
writer.writeRowsAndClose(csvOutputList);
}
File diff suppressed because one or more lines are too long