migration documentation

This commit is contained in:
gexce
2017-08-25 15:42:58 +02:00
parent 26f3598bf1
commit d244f60d1e
21 changed files with 35708 additions and 7 deletions
@@ -19,15 +19,17 @@ import com.univocity.parsers.csv.CsvParserSettings;
public class ToolboxFileExporter {
private static Logger log = Logger.getLogger(ToolboxFileExporter.class);
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-25 - all photo gallery assets.download.log";
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\export - 2017-08-25 - all photo gallery assets.csv";
private List<String[]> rows;
private String baseDir = "D:\\ToolboxMigration_missing";
private String baseDir = "D:\\ToolboxPhotoGallery";
// Formatdatei generiert mit
// bcp "SELECT OriginalImage FROM AssetImages WHERE AssetID=586" queryout Image.jpg -S MOVNCG -d Bayertoolbox_prod -T
// Geben Sie den Dateispeichertyp des Felds OriginalImage ein [varbinary(max)]: x
// Geben Sie die Prfixlnge des OriginalImage-Felds ein [8]: 0
// Geben Sie die Präfixlänge des OriginalImage-Felds ein [8]: 0
// Geben Sie das Feldabschlusszeichen ein [none]:
// Abruf:
@@ -54,7 +56,7 @@ public class ToolboxFileExporter {
}
else {
log.info("Download for asset " + assetId + ", OriginalFilename: '" + originalFilenname + "'");
Process process = Runtime.getRuntime().exec(command1 + assetId + command2 + originalFilenname + command3, null, workingDir);
Process process = Runtime.getRuntime().exec(command1 + assetId + command2 + assetId + command3, null, workingDir);
process.waitFor();
if (0 < process.exitValue()) {
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
@@ -75,7 +77,7 @@ public class ToolboxFileExporter {
CsvParser parser = new CsvParser(settings);
rows = parser.parseAll(new File("C:\\Temp\\Migration CS - SQL Server\\missing_after_clean.csv"));
rows = parser.parseAll(new File(toolboxExportFilePath));
}
@@ -83,7 +85,7 @@ public class ToolboxFileExporter {
try {
Layout layout = new PatternLayout("%d{ISO8601} - %p %m%n"); // "%d{ISO8601} - %p %m%n"
BasicConfigurator.configure(new ConsoleAppender(layout));
BasicConfigurator.configure(new RollingFileAppender(layout, "C:\\Temp\\Migration CS - SQL Server\\missing_after_clean.log", false));
BasicConfigurator.configure(new RollingFileAppender(layout, logfilePath, false));
log.setLevel(Level.DEBUG);
long startTime = System.currentTimeMillis();
@@ -8,6 +8,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Layout;
@@ -31,6 +32,10 @@ public class ToolboxImportFileGenerator {
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - SQL Server\\export-2017-08-15-update_incl_Releases.csv";
private static String licenseGuidsFilePath = "C:\\Temp\\Migration CS - SQL Server\\Release_GUIDs.csv";
// XXX
private static String migration2Path = "C:\\Temp\\Migration CS - SQL Server\\ToolboxMigration2-listing_incl_videos.txt";
private List<String> mig2Filenames;
// XXX Spreadsheet needs be be named "Records" in Excel for the importer
private static String importFilePath = "C:\\Temp\\Migration CS - SQL Server\\export-2017-08-15-update_incl_Releases-IMPORT.csv";
@@ -1001,7 +1006,9 @@ public class ToolboxImportFileGenerator {
log.error("License " + line[1] + " has multiple keys");
}
}
// XXX
mig2Filenames = FileUtils.readLines(new File(migration2Path), "UTF-8");
generateAssetDecriptions();
writeImportFile();
@@ -1020,6 +1027,9 @@ public class ToolboxImportFileGenerator {
long statusSkipped = 0;
long assetTypeNull = 0;
long releaseMissing = 0;
// XXX
int mig2 = 0;
for (String[] line : inputRows) {
Integer assetId = Integer.parseInt(line[0]);
@@ -1066,6 +1076,14 @@ public class ToolboxImportFileGenerator {
asset = new CropScienceAsset(assetId);
asset.assetPath = uploadPath;
// XXX
if (mig2Filenames.contains(line[1])) {
asset.assetPath = "/Resources/Upload/ToolboxMigration2";
mig2++;
}
asset.filename = line[1];
asset.byr_Title = line[2];
@@ -1200,6 +1218,7 @@ 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() {
@@ -58,6 +58,9 @@ AND a.isDeleted = 0
AND (a.FocusID IS NULL OR a.FocusID != 3 OR (a.FocusID = 3 AND a.CreatedOn > Convert(datetime, '2016-01-01')))
AND grp.GroupName != 'Administrator'
-- Photo Gallery
--AND a.FamilyID = 3
/*
AND a.AssetID IN (24024,24014,24007,23933,23932,23830,23826,23805,23804,