Weekend-Upload
This commit is contained in:
@@ -70,7 +70,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
static final String mamHost = "https://service.media-assistant.animalhealth.bayer.com";
|
||||
|
||||
// XXX
|
||||
static final String fileCache = "E:\\_TEST\\";
|
||||
static final String fileCache = "E:\\";
|
||||
|
||||
static final String categoryJson = "resources/2017-10-19_categories.json";
|
||||
static final String categoryMapping = "resources/Media_Assistant_Categories_131017_EDITED_without_archive.csv";
|
||||
@@ -111,13 +111,11 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
|
||||
// XXX ----------------------------------------------------------------
|
||||
// Option 1: Process all available entries
|
||||
// entrySelection = new ArrayList<Long>(entryMap.keySet());
|
||||
entrySelection = new ArrayList<Long>(entryMap.keySet());
|
||||
|
||||
// Option 2: Process a fixed set of entry IDs
|
||||
// entrySelection = Arrays.asList(71725L, 71263L, 71048L, 70778L, 70746L, 70745L, 70440L, 70361L, 70340L, 70288L, 70161L, 70142L,
|
||||
// 63924L, 63201L, 57641L, 56942L);
|
||||
|
||||
entrySelection = Arrays.asList(71537L);
|
||||
// entrySelection = Arrays.asList(71725L, 71537L, 71263L, 71048L, 70778L, 70746L, 70745L,
|
||||
// 70440L, 70361L, 70340L, 70288L, 70161L, 70142L, 63924L, 63201L, 57641L, 56942L);
|
||||
|
||||
// Option 3: Read entry IDs from file
|
||||
// entrySelection = new ArrayList<Long>();
|
||||
@@ -202,7 +200,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
|
||||
while (openUploads.size() > 0) {
|
||||
log.debug("Sleeping...");
|
||||
TimeUnit.SECONDS.sleep(10);
|
||||
TimeUnit.SECONDS.sleep(120);
|
||||
|
||||
log.debug("Checking back on open uploads");
|
||||
attachOpenUploads();
|
||||
@@ -439,6 +437,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
if (entry.creationDate != null)
|
||||
record.addField("byr_ah_releaseDate", isoDate.format(entry.creationDate));
|
||||
|
||||
record.addField("byr_ah_language", Collections.singletonList(Definitions.defaultRecordLanguage));
|
||||
|
||||
if (entry.metaData.get("photographer") != null)
|
||||
record.addField("byr_ah_photographer", entry.metaData.get("photographer"));
|
||||
|
||||
@@ -635,6 +635,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("Selected master file " + masterFile.getAbsolutePath() + " for record " + recordLocation);
|
||||
filesForUpload.add(masterFile);
|
||||
hrefsForUpload.add(selectedDownload.href);
|
||||
}
|
||||
@@ -701,7 +702,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
}
|
||||
else {
|
||||
// TODO
|
||||
log.debug("File too large, could not upload " + file.getName() + " for " + recordLocation);
|
||||
log.error("File too large, could not upload " + file.getName() + " for " + recordLocation);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -728,8 +729,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
HttpEntity<UploadFileRecord> httpEntity = new HttpEntity<UploadFileRecord>(fileRecord, adamHeaders);
|
||||
|
||||
try {
|
||||
ResponseEntity<Void> response = restTemplate.exchange(Definitions.adamHost + reference.targetRecord, HttpMethod.PUT, httpEntity, Void.class);
|
||||
log.debug("ATTACH RESULT Attached " + reference.cachePath + " (" + reference.isMaster + ") to " + reference.targetRecord);
|
||||
restTemplate.exchange(Definitions.adamHost + reference.targetRecord, HttpMethod.PUT, httpEntity, Void.class);
|
||||
log.debug("ATTACH RESULT Attached " + reference.cachePath + " (" + reference.isMaster + ") to " + reference.targetRecord + " via " + reference.token);
|
||||
}
|
||||
catch (RestClientException rce) {
|
||||
log.error("ATTACH RESULT Exception while attaching file " + reference.cachePath + " (" + reference.isMaster + ") for " + reference.targetRecord + ": " + rce.getMessage());
|
||||
@@ -739,7 +740,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
processedReferences.add(reference);
|
||||
}
|
||||
else {
|
||||
log.debug("Checking status of " + reference.cachePath + " for " + reference.uri);
|
||||
log.debug("Checking status of " + reference.cachePath + " for " + reference.targetRecord + " at " + reference.uri);
|
||||
try {
|
||||
UploadResult result = restTemplate.exchange(Definitions.adamHost + reference.uri, HttpMethod.GET, adamHeadersEntity, UploadResult.class).getBody();
|
||||
log.debug("Result: " + result);
|
||||
|
||||
Reference in New Issue
Block a user