diff --git a/AH MAM Migration/notes.txt b/AH MAM Migration/notes.txt index 4a4e1c5..0c14b02 100644 --- a/AH MAM Migration/notes.txt +++ b/AH MAM Migration/notes.txt @@ -1,3 +1,42 @@ +# Probleme 10.122.106.179 +- Bilder liegen teilw. nur als zip vor, z.B. 71263 + Lösungsansatz Heuristik: wenn nur zip vorhanden und kleiner als Threshold, entpackt hochladen + https://stackoverflow.com/questions/9324933/what-is-a-good-java-library-to-zip-unzip-files + +- Beispiel-Records: + Advertising Media CAP + MA-ID 00071048 OK + MA-ID 00070778 OK + MA-ID 00070746 OK + + Advertising Media FAP + MA-ID 00070142 OK + MA-ID 00070361 + MA-ID 00063924 + + Images + MA-ID 00071263 OK + MA-ID 00063201 + MA-ID 00056942 + MA-ID 00057641 + + Videos (mit allen Downloadmöglichkeiten) + MA-ID 00070745 + MA-ID 00070440 + MA-ID 00070340 + + Guidelines + MA-ID 00070288 + MA-ID 00071725 OK + +- PROD: Problem mit Campaigns: +2017-11-03 11:17:26 ERROR- Could not create campaign year '2017' for entry 72048: 500 +2017-11-03 11:17:26 ERROR- {"exceptionMessage":"The object cannot be saved because it already exists.","exceptionType":"Adam.Core.ItemAlreadyExistsException"} +2017-11-03 11:17:26 INFO - Create campaign 2017/2017 - Ecto Book + +- Selections + + # 2017-10-27 - Vermerke im Excel nachziehen [erledigt] - Brand Baytril existiert für CAP und FAP!! [erledigt] @@ -20,7 +59,6 @@ - s. Excel - 1. Status - Übertragen der Datensätze funktioniert grundsätzlich - MAM -> JSON (komme darauf zurück) -> eDAM diff --git a/AH MAM Migration/pom.xml b/AH MAM Migration/pom.xml index 689daff..41c70f8 100644 --- a/AH MAM Migration/pom.xml +++ b/AH MAM Migration/pom.xml @@ -43,6 +43,11 @@ commons-io 2.5 + + net.lingala.zip4j + zip4j + 1.3.2 + diff --git a/AH MAM Migration/resources/application.properties b/AH MAM Migration/resources/application.properties index d773997..3fbba44 100644 --- a/AH MAM Migration/resources/application.properties +++ b/AH MAM Migration/resources/application.properties @@ -2,4 +2,4 @@ logging.level.com.bayer=DEBUG #logging.level.com.bayer.edam.migration.interceptors=INFO logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level- %msg%n -logging.file=test.log +logging.file=application-WEEKEND.log diff --git a/AH MAM Migration/src/com/bayer/edam/migration/Definitions.java b/AH MAM Migration/src/com/bayer/edam/migration/Definitions.java index d4648b2..fd3a533 100644 --- a/AH MAM Migration/src/com/bayer/edam/migration/Definitions.java +++ b/AH MAM Migration/src/com/bayer/edam/migration/Definitions.java @@ -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(); users = new HashMap(); + + // QA values classifications.put("Migration", new WriteClassification("2bd24882-b7d8-4d30-8e6f-a7ef00eb33e7", 1)); classifications.put("Migration.Logos", new WriteClassification("de96f8db1de44cc6841ba81c00b9db8e", 1)); diff --git a/AH MAM Migration/src/com/bayer/edam/migration/MamMigrationSelective.java b/AH MAM Migration/src/com/bayer/edam/migration/MamMigrationSelective.java index 9c57c4c..a940c11 100644 --- a/AH MAM Migration/src/com/bayer/edam/migration/MamMigrationSelective.java +++ b/AH MAM Migration/src/com/bayer/edam/migration/MamMigrationSelective.java @@ -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 entrySelection = new ArrayList(Arrays.asList( 48147 /* 58443/*, 53787, 32427, 71725, 63080*/ )); // 72048, 60984 + private List entrySelection = new ArrayList(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 httpEntity = new HttpEntity(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());