Photo Gallery migration
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
1185;soybean1.jpg;Soybean;PG001185;Soybean Image;2;2010-11-07 00:00:00.000;1;2010-11-07 17:03:55.690;NULL;NULL;NULL;NULL;NULL;NULL;434676;2010-11-07 00:00:00.000;2011-02-01 00:00:00.000;2010;NULL;0;Bayer;Administrator;Bayer CropScience;Other;Archive;NULL;BCS - Base;20;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011;1;2;Jason Molyneaux;2012-02-02 00:22:21.743;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011-R0.pdf;C:\inetpub\wwwroot\HttpTemp\UploadedFIles\;Mandy;Cornwell;LBi;4;Arkansas;;Crop;NULL;NULL;Soybean;Soybean;NULL;NULL;NULL;NULL;;3
|
1185;soybean1.jpg;Soybean;PG001185;Soybean Image;2;2010-11-07 00:00:00.000;1;2010-11-07 17:03:55.690;NULL;NULL;NULL;NULL;NULL;NULL;434676;2010-11-07 00:00:00.000;2011-02-01 00:00:00.000;2010;NULL;0;Bayer;Administrator;Bayer CropScience;Other;Archive;NULL;BCS - Base;20;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011;1;2;Jason Molyneaux;2012-02-02 00:22:21.743;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011-R0.pdf;C:\inetpub\wwwroot\HttpTemp\UploadedFIles\;Mandy;Cornwell;LBi;4;Arkansas;;Crop;NULL;NULL;Soybean;Soybean;NULL;NULL;NULL;NULL;;3
|
||||||
2275;barley-2.tif;Barley Field Late Maturity;PG002275;;2;2010-12-07 00:00:00.000;57;2010-12-07 17:22:20.930;NULL;NULL;NULL;NULL;NULL;NULL;29088246;2010-12-07 00:00:00.000;2015-12-07 00:00:00.000;2010;NULL;0;"Jeremy ";Povenmire;AdFarm;Other;Archive;NULL;BCS - Base;20;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011;1;2;Jason Molyneaux;2012-02-02 00:22:21.743;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011-R0.pdf;C:\inetpub\wwwroot\HttpTemp\UploadedFIles\;Mandy;Cornwell;LBi;35;North Dakota;;Crop;NULL;NULL;Cereal;Late Maturity;NULL;NULL;NULL;NULL;;3
|
2275;barley-2.tif;Barley Field Late Maturity;PG002275;;2;2010-12-07 00:00:00.000;57;2010-12-07 17:22:20.930;NULL;NULL;NULL;NULL;NULL;NULL;29088246;2010-12-07 00:00:00.000;2015-12-07 00:00:00.000;2010;NULL;0;"Jeremy ";Povenmire;AdFarm;Other;Archive;NULL;BCS - Base;20;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011;1;2;Jason Molyneaux;2012-02-02 00:22:21.743;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011-R0.pdf;C:\inetpub\wwwroot\HttpTemp\UploadedFIles\;Mandy;Cornwell;LBi;35;North Dakota;;Crop;NULL;NULL;Cereal;Late Maturity;NULL;NULL;NULL;NULL;;3
|
||||||
1164;_I2D0257.jpg;Rice Field Shot;PG001164;Rice field shot;2;2010-11-05 00:00:00.000;57;2010-12-02 11:49:07.063;57;NULL;NULL;NULL;NULL;NULL;515880;2010-12-01 00:00:00.000;2012-12-01 00:00:00.000;2009;NULL;0;"Jeremy ";Povenmire;AdFarm;Other;Archive;NULL;BCS - Base;20;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011;1;2;Jason Molyneaux;2012-02-02 00:22:21.743;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011-R0.pdf;C:\inetpub\wwwroot\HttpTemp\UploadedFIles\;Mandy;Cornwell;LBi;26;Missouri;;Crop;NULL;NULL;Rice;Mid Maturity;NULL;NULL;NULL;NULL;;3
|
1164;_I2D0257.jpg;Rice Field Shot;PG001164;Rice field shot;2;2010-11-05 00:00:00.000;57;2010-12-02 11:49:07.063;57;NULL;NULL;NULL;NULL;NULL;515880;2010-12-01 00:00:00.000;2012-12-01 00:00:00.000;2009;NULL;0;"Jeremy ";Povenmire;AdFarm;Other;Archive;NULL;BCS - Base;20;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011;1;2;Jason Molyneaux;2012-02-02 00:22:21.743;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011-R0.pdf;C:\inetpub\wwwroot\HttpTemp\UploadedFIles\;Mandy;Cornwell;LBi;26;Missouri;;Crop;NULL;NULL;Rice;Mid Maturity;NULL;NULL;NULL;NULL;;3
|
||||||
1160;_I2D0007.jpg;Corn Field Shot;PG001160;Corn field shot;2;2010-11-05 00:00:00.000;57;2010-12-02 11:17:10.313;57;NULL;NULL;NULL;NULL;NULL;763176;2010-12-01 00:00:00.000;2012-12-01 00:00:00.000;2010;NULL;0;"Jeremy ";Povenmire;AdFarm;Other;Archive;NULL;BCS - Base;20;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011;1;2;Jason Molyneaux;2012-02-02 00:22:21.743;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011-R0.pdf;C:\inetpub\wwwroot\HttpTemp\UploadedFIles\;Mandy;Cornwell;LBi;16;Iowa;;Crop;NULL;NULL;NULL;NULL;NULL;NULL;NULL;NULL;;3
|
1160;_I2D0007.jpg;Corn Field Shot;PG001160;Corn field shot;2;2010-11-05 00:00:00.000;57;2010-12-02 11:17:10.313;57;NULL;NULL;NULL;NULL;NULL;763176;2010-12-01 00:00:00.000;2012-12-01 00:00:00.000;2010;NULL;0;"Jeremy ";Povenmire;AdFarm;Other;Archive;NULL;BCS - Base;20;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011;1;2;Jason Molyneaux;2012-02-02 00:22:21.743;Jason Molyneaux Copyright Transfer BCS Crop Photos 08-03-2011-R0.pdf;C:\inetpub\wwwroot\HttpTemp\UploadedFIles\;Mandy;Cornwell;LBi;16;Iowa;;Crop;NULL;NULL;NULL;NULL;NULL;NULL;NULL;NULL;;3
|
||||||
|
|||||||
|
Can't render this file because it is too large.
|
@@ -31,12 +31,12 @@ 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\\2017-12-12 example photo 5531.csv";
|
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\2017-12-13 complete photo gallery with additional columns (can contain multiple lines per asset).csv";
|
||||||
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\2017-12-12 example photo 5531.csv.generator.log";
|
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\2017-12-13 complete photo gallery with additional columns (can contain multiple lines per asset).csv.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\\2017-12-12 example photo 5531.generator.csv";
|
private static String importFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\2017-12-13 complete photo gallery with additional columns (can contain multiple lines per asset).generator.csv";
|
||||||
private static String uploadPath = "/Resources/Upload/ToolboxPhotoGallery";
|
private static String uploadPath = "/Resources/Upload/ToolboxPhotoGallery";
|
||||||
|
|
||||||
private static final Map<String, String> brandMap;
|
private static final Map<String, String> brandMap;
|
||||||
@@ -1181,7 +1181,7 @@ public class ToolboxImportFileGenerator {
|
|||||||
+ ")]";
|
+ ")]";
|
||||||
|
|
||||||
if (photoGalleryItem) {
|
if (photoGalleryItem) {
|
||||||
if (!line[41].equals("NULL") && line[40].length() > 0);
|
if (line[41] != null && !line[41].equals("NULL") && line[41].length() > 0);
|
||||||
injectDescription(asset, "Geographic Information: " + line[41]);
|
injectDescription(asset, "Geographic Information: " + line[41]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1217,7 +1217,7 @@ public class ToolboxImportFileGenerator {
|
|||||||
injectDescription(asset, event);
|
injectDescription(asset, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!line[51].equals("NULL") && line[51].length() > 0) {
|
if (line[51] != null && !line[51].equals("NULL") && line[51].length() > 0) {
|
||||||
injectDescription(asset, "Names of persons in photograph: " + line[51]);
|
injectDescription(asset, "Names of persons in photograph: " + line[51]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1347,27 +1347,35 @@ public class ToolboxImportFileGenerator {
|
|||||||
log.info("Internal assets: " + internalAssets);
|
log.info("Internal assets: " + internalAssets);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean injectDescription(CropScienceAsset asset, String desciption) {
|
private boolean injectDescription(CropScienceAsset asset, String description) {
|
||||||
if (asset.byr_cs_description == null || asset.byr_cs_description.length() == 0) {
|
if (asset.byr_cs_description == null || asset.byr_cs_description.length() == 0) {
|
||||||
asset.byr_cs_description = desciption;
|
asset.byr_cs_description = description;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] descLines = asset.byr_cs_description.split("\n");
|
String[] descLines = asset.byr_cs_description.split("\n");
|
||||||
for (int i = 0; i < descLines.length; i++) {
|
for (int i = 0; i < descLines.length; i++) {
|
||||||
if (descLines[i].equals(desciption))
|
if (descLines[i].equals(description))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int position = asset.byr_cs_description.indexOf("\n\n[Asset imported from Toolbox");
|
int position = asset.byr_cs_description.indexOf("\n\n[Asset imported from Toolbox");
|
||||||
|
|
||||||
if (position < 0) {
|
if (position < 0) {
|
||||||
log.warn("No import description found");
|
position = asset.byr_cs_description.indexOf("[Asset imported from Toolbox");
|
||||||
asset.byr_cs_description += "\n" + desciption;
|
|
||||||
return true;
|
if (position == 0) {
|
||||||
|
asset.byr_cs_description = "\n\n" + asset.byr_cs_description;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.warn("No import description found");
|
||||||
|
asset.byr_cs_description += "\n" + description;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
asset.byr_cs_description = asset.byr_cs_description.substring(0, position) + "\n" + desciption + asset.byr_cs_description.substring(position);
|
|
||||||
|
asset.byr_cs_description = asset.byr_cs_description.substring(0, position) + "\n" + description + asset.byr_cs_description.substring(position);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1468,7 +1476,7 @@ public class ToolboxImportFileGenerator {
|
|||||||
Layout layout = new PatternLayout("%p %m%n"); // "%d{ISO8601} - %p %m%n"
|
Layout layout = new PatternLayout("%p %m%n"); // "%d{ISO8601} - %p %m%n"
|
||||||
BasicConfigurator.configure(new ConsoleAppender(layout));
|
BasicConfigurator.configure(new ConsoleAppender(layout));
|
||||||
BasicConfigurator.configure(new RollingFileAppender(layout, logfilePath, false));
|
BasicConfigurator.configure(new RollingFileAppender(layout, logfilePath, false));
|
||||||
log.setLevel(Level.INFO);
|
log.setLevel(Level.DEBUG);
|
||||||
|
|
||||||
new ToolboxImportFileGenerator();
|
new ToolboxImportFileGenerator();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user