close to run
This commit is contained in:
+5
-5
@@ -219,7 +219,7 @@ skip;BusinessUnit.General,Brand.General,MediaType.Guideline;;;Guidelines;;;;;;
|
||||
skip;;;;;AH Meeting Culture;;;;;
|
||||
skip;;;;;Agency Briefing Templates;;;;;
|
||||
skip;;;;;BAH eDetailer Template;;;;;
|
||||
classify;BusinessUnit.CAP;;;;CAP Brand/Packaging Design;;;;;kann eine Guideline in Brand.General, aber in BusinessUnit CAP sein?
|
||||
skip;BusinessUnit.CAP;;;;CAP Brand/Packaging Design;;;;;kann eine Guideline in Brand.General, aber in BusinessUnit CAP sein?
|
||||
campaign;(2009-2017);;;;;Advantage Family;;;;
|
||||
campaign;(2003-2012);;;;;Bolfo/Bayopet (OTC);;;;
|
||||
campaign;(2012-2017);;;;;Drontal Product Family;;;;
|
||||
@@ -228,12 +228,12 @@ campaign;(2005);;;;;Kiltix Products;;;;
|
||||
campaign;(2017);;;;;Lifestyle Photography 2017;;;;
|
||||
campaign;(2009-2012);;;;;Profender Products;;;;
|
||||
campaign;(2011-2017);;;;;Seresto Packaging;;;;
|
||||
classify;BusinessUnit.FAP;;;;FAP Brand/Packaging Design;;;;;
|
||||
skip;BusinessUnit.FAP;;;;FAP Brand/Packaging Design;;;;;
|
||||
campaign;(2011);;;;;Farm Animal Products;;;;
|
||||
campaign;(2006);;;;;Farmhygiene Products;;;;
|
||||
skip;;;;;Global Exhibit Design Manual;;;;;
|
||||
not migrated;;;;;Training Tools - MediaAssistant;;;;;
|
||||
classify;BusinessUnit.General;;;Images;;;kommt komplett in Space General;;;Nach Motives-Baum unter Images
|
||||
classify;BusinessUnit.General,Brand.General;;;Images;;;kommt komplett in Space General;;;Nach Motives-Baum unter Images
|
||||
motives;;;;;Applications;;;;;
|
||||
motives;;;;;Different animals together;;;;;
|
||||
motives;;;;;Disease Symptoms;;;;;
|
||||
@@ -283,7 +283,7 @@ motives;;;;;;Zoo and other animals;;;;
|
||||
motives;;;;;Worms (Helminths);;;;;
|
||||
motives;;;;;;Roundworms;;;;
|
||||
motives;;;;;;Tapeworms;;;;
|
||||
skip;;;;Logos;;;;;;bitte den Brands zuordnen
|
||||
not migrated;;;;Logos;;;;;;bitte den Brands zuordnen
|
||||
skip;;;;Packshots;;;;;;
|
||||
classify;BusinessUnit.CAP,Brand.Advantage;;;;Advantage;;;;;
|
||||
classify;BusinessUnit.CAP,Brand.Advantix;;;;Advantix;;;;;
|
||||
@@ -341,7 +341,7 @@ brand;;;;;;Seresto;;;;
|
||||
not migrated;;;BAH Image series;;;;;;;wird nicht migriert
|
||||
skip;;;;Image series 1;;;;;;
|
||||
skip;;;;Image series 2;;;;;;
|
||||
classify;Status.Archived;;BAH Internal Videos;;"alle ins Archiv -> unter classification ""interne Videos""";;;;;
|
||||
not migrated;Status.Archived;;BAH Internal Videos;;"alle ins Archiv -> unter classification ""interne Videos""";;;;;BusinessUnit? Brand?
|
||||
not migrated;;;BAH Webshop;;;;;;;wird nicht migriert
|
||||
skip;;;;Advantage;;;;;;
|
||||
skip;;;;Advantix;;;;;;
|
||||
|
||||
|
BIN
Binary file not shown.
@@ -15,6 +15,7 @@ public class Definitions {
|
||||
public static final Map<String, String> classificationGuidToKeyMap;
|
||||
public static final Map<String, String> fieldIDs;
|
||||
public static final Map<Long, String> mediaTypes;
|
||||
public static final Map<String, String> users;
|
||||
|
||||
public static final String defaultLanguage = "c2bd4f9bbb954bcb80c31e924c9c26dc"; //"00000000000000000000000000000000";
|
||||
public static final String defaultProjectLead = "21cfce6116484269a351a71300e1fed0";
|
||||
@@ -46,6 +47,7 @@ public class Definitions {
|
||||
// /Bayer/Animal Health/Brands
|
||||
classifications.put("Brand.General", new WriteClassification("92b4b27a09f2487dbba6a70f00f7baa3", 1));
|
||||
|
||||
// CAP
|
||||
classifications.put("Brand.Advantage", new WriteClassification("b3f04996de1644df9d08a6dd00cff70e", 1));
|
||||
classifications.put("Brand.Advantix", new WriteClassification("dc758de7d91e44d6a768a6dd00cff7ad", 1));
|
||||
classifications.put("Brand.Advocate", new WriteClassification("c7979fc30bb843e486bba6dd00cff835", 1));
|
||||
@@ -62,6 +64,7 @@ public class Definitions {
|
||||
classifications.put("Brand.miscellaneous", new WriteClassification("bc9d93616c0548f99f7fa6dd00cff69d", 1));
|
||||
classifications.put("Brand.Miscellaneous", new WriteClassification("bc9d93616c0548f99f7fa6dd00cff69d", 1));
|
||||
|
||||
// FAP
|
||||
classifications.put("Brand.Baycox", new WriteClassification("ef3028f6ba8744508035a6dd00cffe45", 1));
|
||||
classifications.put("Brand.Bayticol", new WriteClassification("bd1819c976e643bf916ba6dd00cffec4", 1));
|
||||
classifications.put("Brand.Baytril", new WriteClassification("1053978a142742ad8033a6dd00cfff42", 1));
|
||||
@@ -76,6 +79,7 @@ public class Definitions {
|
||||
classifications.put("Brand.Zelnate", new WriteClassification("b3887552c9554d6991e4a6dd00d006ee", 1));
|
||||
classifications.put("Brand.FAP.Others", new WriteClassification("ac169c77ab944a03bfada70f00f7ac43", 1));
|
||||
|
||||
// Media Types
|
||||
classifications.put("MediaType.Other", new WriteClassification("7c13e620-7eb0-4c12-9dfb-a7b4008f19b1", 1));
|
||||
classifications.put("MediaType.Banner", new WriteClassification("eb786339a5de44679ff6a7b4008f1ee0", 1));
|
||||
classifications.put("MediaType.Book", new WriteClassification("25a59832a6f84cb0a477a73100a2a091", 1));
|
||||
@@ -104,6 +108,20 @@ public class Definitions {
|
||||
classificationGuidToKeyMap.put(entry.getValue().id, entry.getKey());
|
||||
}
|
||||
|
||||
// Fields
|
||||
fieldIDs = new HashMap<String, String>();
|
||||
fieldIDs.put("byr_Title", "31f337fa-add6-4e25-a672-a68a00d4ff3b");
|
||||
fieldIDs.put("byr_ah_approvalNumber", "69d65b63-613b-49d6-bc11-a731010bbec8");
|
||||
fieldIDs.put("byr_ah_description", "f9e40f87-493e-4f17-b129-a6dd00d063b2"); // Additional Information
|
||||
fieldIDs.put("byr_ah_projectLead", "5400d446-9d95-4158-ac06-a6dd00d06a12");
|
||||
fieldIDs.put("byr_ah_brandCommunicationRepresentative", "5b34f2db-efff-48fd-bc7f-a731010bbda1");
|
||||
fieldIDs.put("byr_creationDate", "403fea1c-c154-4e3b-a941-a68a00d4fcc3");
|
||||
fieldIDs.put("byr_ah_keywords_tl", "6d582cfaa5b94101ab1fa6fd007e2fcd");
|
||||
fieldIDs.put("byr_ah_licenseHolderList", "de3f83cb50e747228bfea731010bc27c");
|
||||
fieldIDs.put("byr_ah_licenseAdditionalPermittedUse", "5c9d43a0-bf70-4fb5-8ad4-a731010bc1ef");
|
||||
fieldIDs.put("byr_ah_licenseComments", "dd4b899f-10b7-45db-a530-a6dd00d0630a");
|
||||
|
||||
// Media Type mappings
|
||||
mediaTypes = new HashMap<Long, String>();
|
||||
mediaTypes.put(1L, "MediaType.unassigned");
|
||||
mediaTypes.put(2L, "MediaType.Image");
|
||||
@@ -138,18 +156,15 @@ public class Definitions {
|
||||
mediaTypes.put(32L, "MediaType.Booth");
|
||||
mediaTypes.put(34L, "MediaType.Folder");
|
||||
|
||||
// Fields
|
||||
fieldIDs = new HashMap<String, String>();
|
||||
fieldIDs.put("byr_Title", "31f337fa-add6-4e25-a672-a68a00d4ff3b");
|
||||
fieldIDs.put("byr_ah_approvalNumber", "69d65b63-613b-49d6-bc11-a731010bbec8");
|
||||
fieldIDs.put("byr_ah_description", "f9e40f87-493e-4f17-b129-a6dd00d063b2"); // Additional Information
|
||||
fieldIDs.put("byr_ah_projectLead", "5400d446-9d95-4158-ac06-a6dd00d06a12");
|
||||
fieldIDs.put("byr_ah_brandCommunicationRepresentative", "5b34f2db-efff-48fd-bc7f-a731010bbda1");
|
||||
fieldIDs.put("byr_creationDate", "403fea1c-c154-4e3b-a941-a68a00d4fcc3");
|
||||
fieldIDs.put("byr_ah_keywords_tl", "6d582cfaa5b94101ab1fa6fd007e2fcd");
|
||||
fieldIDs.put("byr_ah_licenseHolderList", "de3f83cb50e747228bfea731010bc27c");
|
||||
fieldIDs.put("byr_ah_licenseAdditionalPermittedUse", "5c9d43a0-bf70-4fb5-8ad4-a731010bc1ef");
|
||||
fieldIDs.put("byr_ah_licenseComments", "dd4b899f-10b7-45db-a530-a6dd00d0630a");
|
||||
users = new HashMap<String, String>();
|
||||
users.put("32300", "02bee145-2a37-4f49-acba-a74600bda888"); // marion.schmidtmeier@bayer.com
|
||||
users.put("32421", "c68e1a72-f218-48f0-ac4d-a72900796cc1"); // claudia.staubes-dunkel@bayer.com
|
||||
users.put("32422", "ef573ad7-aa7f-44cd-9c5f-a743007ecfb6"); // roswitha.wolff@bayer.com
|
||||
users.put("32820", "c24a1e1d-63f7-4713-886c-a7450091a7ed"); // ulrike.kopp@bayer.com
|
||||
users.put("32960", "e5fd6e3b-5650-4dea-b8e7-a743007ecef1"); // susanne.sikorra@bayer.com
|
||||
users.put("33160", "8ce7cc2a-134c-4c65-8e35-a7430089851a"); // nikolaus.brunner@bayer.com
|
||||
users.put("33180", "9e40bd5c-70a9-41e1-8877-a74300744e8b"); // christian.stilez@bayer.com
|
||||
|
||||
}
|
||||
|
||||
public static Field createSingleValueField(String name, String value) {
|
||||
|
||||
@@ -123,8 +123,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
|
||||
|
||||
// XXX
|
||||
if (id > 80000 || id < 72048)
|
||||
continue;
|
||||
// if (id > 80000 || id < 72009) //72048
|
||||
// continue;
|
||||
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
void postToAdam(Entry entry) throws Exception {
|
||||
UploadRecord record = new UploadRecord();
|
||||
String entryJson = jsonMapper.writeValueAsString(entry);
|
||||
Set<String> keywords = new HashSet<String>();
|
||||
|
||||
// globally applicable classifications
|
||||
record.addClassification("MediaAssistant-Migration");
|
||||
@@ -174,7 +175,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
record.addClassification(Definitions.mediaTypes.get(entry.mediaType.id));
|
||||
|
||||
// process categories
|
||||
Set<String> keywords = new HashSet<String>();
|
||||
if (entry.categories.size() > 1)
|
||||
log.warn("Entry " + entry.id + " has " + entry.categories.size() + " categories assigned");
|
||||
|
||||
for (int categoryId : entry.categories) {
|
||||
log.debug("Category: " + categoryId);
|
||||
@@ -209,7 +211,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
if (p.startsWith("Status.")) {
|
||||
if (!p.equals("Status.Released"))
|
||||
record.removeClassification("Status.Released");
|
||||
else if (record.hasClassificationStartingWith("Status.")){
|
||||
else if (record.hasClassificationStartingWith("Status.Draft")
|
||||
|| record.hasClassificationStartingWith("Status.Archived")) {
|
||||
log.warn("Classification Status.Released not added, different status already set");
|
||||
continue;
|
||||
}
|
||||
@@ -222,7 +225,6 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
}
|
||||
|
||||
if (p.startsWith("Brand.")) {
|
||||
// always use the most specific brand
|
||||
if (p.equals("Brand.General") && record.hasClassificationStartingWith("Brand.")) {
|
||||
log.warn("Classification Brand.General not added, different brand already set");
|
||||
continue;
|
||||
@@ -285,7 +287,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
String campaignGuid = null;
|
||||
for (Campaign c : campaigns) {
|
||||
if (c.name.equals(campaignName)) {
|
||||
log.debug("Found already existing campaign '" + campaignName + "' with guid " + campaignGuid);
|
||||
log.debug("Add existing campaign " + campaignName);
|
||||
campaignGuid = c.guid;
|
||||
record.addClassification(new WriteClassification(campaignGuid, 1));
|
||||
}
|
||||
@@ -329,9 +331,23 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
record.addField("byr_Title", "No title");
|
||||
}
|
||||
|
||||
// TODO
|
||||
// Project lead
|
||||
if (entry.user != null && entry.user.get("id") != null) {
|
||||
if (Definitions.users.get(entry.user.get("id")) != null) {
|
||||
record.addField("byr_ah_projectLead", Collections.singletonList(Definitions.users.get(entry.user.get("id"))));
|
||||
record.addField("byr_ah_brandCommunicationRepresentative", Collections.singletonList(Definitions.users.get(entry.user.get("id"))));
|
||||
}
|
||||
else {
|
||||
log.warn("Entry " + entry.id + ": MAM user " + entry.user.get("id") + " not available, assigning default user");
|
||||
record.addField("byr_ah_projectLead", Collections.singletonList(Definitions.defaultProjectLead));
|
||||
record.addField("byr_ah_brandCommunicationRepresentative", Collections.singletonList(Definitions.defaultProjectLead));
|
||||
}
|
||||
}
|
||||
else {
|
||||
log.warn("Entry " + entry.id + ": No user, assigning default user");
|
||||
record.addField("byr_ah_projectLead", Collections.singletonList(Definitions.defaultProjectLead));
|
||||
record.addField("byr_ah_brandCommunicationRepresentative", Collections.singletonList(Definitions.defaultProjectLead));
|
||||
}
|
||||
|
||||
// Description / Additional Information
|
||||
String description = entry.description.get("en");
|
||||
@@ -381,21 +397,20 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
if (entry.gpc != null)
|
||||
record.addField("byr_ah_approvalNumber",entry.gpc.gpcNumber);
|
||||
|
||||
// XXX
|
||||
// Create record
|
||||
// HttpEntity<UploadRecord> httpEntity = new HttpEntity<UploadRecord>(record, adamHeaders);
|
||||
// try {
|
||||
// URI location = restTemplate.postForLocation(adamHost + "/records", httpEntity, UploadRecord.class);
|
||||
// log.info("RESULT Entry " + entry.id + " migrated to record " + location);
|
||||
//
|
||||
// FileUtils.writeStringToFile(entryLog, 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());
|
||||
// log.error(hsce.getResponseBodyAsString());
|
||||
// FileUtils.writeStringToFile(problemLog, entry.id + fieldSeparator + entryJson + lineSeparator, Charset.forName("utf-8"), true);
|
||||
// }
|
||||
HttpEntity<UploadRecord> httpEntity = new HttpEntity<UploadRecord>(record, adamHeaders);
|
||||
try {
|
||||
URI location = restTemplate.postForLocation(adamHost + "/records", httpEntity, UploadRecord.class);
|
||||
log.info("RESULT Entry " + entry.id + " migrated to record " + location);
|
||||
|
||||
FileUtils.writeStringToFile(entryLog, 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());
|
||||
log.error(hsce.getResponseBodyAsString());
|
||||
FileUtils.writeStringToFile(problemLog, entry.id + fieldSeparator + entryJson + lineSeparator, Charset.forName("utf-8"), true);
|
||||
}
|
||||
}
|
||||
|
||||
private void readEntryIDsFromFile() throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user