Wochenende

This commit is contained in:
gexce
2017-11-03 17:17:03 +01:00
parent 5b2b5c7a83
commit 79b71a2e7e
5 changed files with 58 additions and 13 deletions
@@ -35,8 +35,8 @@ public class Definitions {
//
// public static final String defaultLanguage = "c2bd4f9bbb954bcb80c31e924c9c26dc"; // /System/Languages/English
// public static final String defaultProjectLead = "99ca421d2f7a4aea8096a81f00bd177c"; // InterfaceUserAH
// public static final String defaultLicenseHolder = ""; // Bayer Animal Health GmbH // TODO
// public static final String defaultAdditionalPermittedUse = ""; // N/A // TODO
// public static final String defaultLicenseHolder = "81c13edeb06f44aab672a747007fe56b"; // Bayer Animal Health GmbH
// public static final String defaultAdditionalPermittedUse = "30a04c1dbb24486f823ea73e00dbab92"; // N/A
//
// public static final String campaignRoot = "8fb6a504e2824ba9858aa7970078cb88";
@@ -48,6 +48,8 @@ public class Definitions {
fieldIDs = new HashMap<String, String>();
users = new HashMap<String, String>();
// QA values
classifications.put("Migration", new WriteClassification("2bd24882-b7d8-4d30-8e6f-a7ef00eb33e7", 1));
classifications.put("Migration.Logos", new WriteClassification("de96f8db1de44cc6841ba81c00b9db8e", 1));
@@ -57,7 +57,7 @@ public class MamMigrationSelective implements CommandLineRunner {
private static final Logger log = LoggerFactory.getLogger(MamMigrationSelective.class);
static final String mamHost = "https://service.media-assistant.animalhealth.bayer.com";
private List<Integer> entrySelection = new ArrayList<Integer>(Arrays.asList( 48147 /* 58443/*, 53787, 32427, 71725, 63080*/ )); // 72048, 60984
private List<Integer> entrySelection = new ArrayList<Integer>(Arrays.asList( 72048, 60984 /*48147 /* 58443/*, 53787, 32427, 71725, 63080*/ )); // 72048, 60984
static final String categoryJson = "resources/2017-10-19_categories.json";
static final String categoryMapping = "resources/Media_Assistant_Categories_131017_EDITED_without_archive.csv";
@@ -90,7 +90,7 @@ public class MamMigrationSelective implements CommandLineRunner {
public void run(String... strings) throws Exception {
// XXX
// readEntryIDsFromFile();
readEntryIDsFromFile();
log.info("Write log headers for " + entryLog.getAbsolutePath());
FileUtils.writeStringToFile(entryLog, "entryId" + fieldSeparator + "Location" + fieldSeparator + "Entry" + lineSeparator, Charset.forName("utf-8"));
@@ -127,8 +127,8 @@ public class MamMigrationSelective implements CommandLineRunner {
// XXX
// if needed start from a certain ID
// if (id > 32954)
// continue;
if (id >= 32935)
continue;
log.info("GET entry " + id);
@@ -437,16 +437,16 @@ public class MamMigrationSelective implements CommandLineRunner {
HttpEntity<UploadRecord> httpEntity = new HttpEntity<UploadRecord>(record, adamHeaders);
try {
// URI location = restTemplate.postForLocation(Definitions.adamHost + "/records", httpEntity, UploadRecord.class);
// log.info("RESULT Entry " + entry.id + " migrated to record " + location);
URI location = restTemplate.postForLocation(Definitions.adamHost + "/records", httpEntity, UploadRecord.class);
log.info("RESULT Entry " + entry.id + " migrated to record " + location);
// XXX
uploadFilesForEntry(entry);
// uploadFilesForEntry(entry);
// TODO process file upload errors
// FileUtils.writeStringToFile(entryLog, entry.id + fieldSeparator + location.toString() + fieldSeparator + entryJson + lineSeparator,
// Charset.forName("utf-8"), true);
FileUtils.writeStringToFile(entryLog, entry.id + fieldSeparator + location.toString() + fieldSeparator + entryJson + lineSeparator,
Charset.forName("utf-8"), true);
}
catch (HttpStatusCodeException hsce) {
log.error("RESULT Skipping entry " + entry.id + ": Error while creating record " + hsce.getStatusCode().toString());