Let's go to production, weekend edition
This commit is contained in:
@@ -2,4 +2,4 @@
|
|||||||
logging.level.com.bayer=DEBUG
|
logging.level.com.bayer=DEBUG
|
||||||
#logging.level.com.bayer.edam.migration.interceptors=INFO
|
#logging.level.com.bayer.edam.migration.interceptors=INFO
|
||||||
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level- %msg%n
|
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level- %msg%n
|
||||||
logging.file=application_2017-11-10_PROD.log
|
logging.file=application_2017-11-10_Weekend_PROD.log
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class Definitions {
|
|||||||
fieldIDs = new HashMap<String, String>();
|
fieldIDs = new HashMap<String, String>();
|
||||||
users = new HashMap<String, String>();
|
users = new HashMap<String, String>();
|
||||||
|
|
||||||
classifications.put("Migration.Test", new WriteClassification("f1d058987a3043d5b021a819007ff3c0", 1));
|
classifications.put("Migration.Test", new WriteClassification("704deb515e024874a4a0a82700a4dc78", 1));
|
||||||
|
|
||||||
// XXX QA values
|
// XXX QA values
|
||||||
// classifications.put("Migration", new WriteClassification("2bd24882-b7d8-4d30-8e6f-a7ef00eb33e7", 1));
|
// classifications.put("Migration", new WriteClassification("2bd24882-b7d8-4d30-8e6f-a7ef00eb33e7", 1));
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
private static final Logger log = LoggerFactory.getLogger(MamMigrationSelective.class);
|
private static final Logger log = LoggerFactory.getLogger(MamMigrationSelective.class);
|
||||||
|
|
||||||
static final String mamHost = "https://service.media-assistant.animalhealth.bayer.com";
|
static final String mamHost = "https://service.media-assistant.animalhealth.bayer.com";
|
||||||
private List<Integer> entrySelection = new ArrayList<Integer>(Arrays.asList( /*71725, 71263, 71048, 70778, 70746, 70745, 70440, 70361, 70340, 70288, 70161, 70142, 63924, */63201, 57641, 56942 ));
|
private List<Integer> entrySelection = new ArrayList<Integer>(Arrays.asList( 71725, 71263, 71048, 70778, 70746, 70745, 70440, 70361, 70340, 70288, 70161, 70142, 63924, 63201, 57641, 56942 ));
|
||||||
|
|
||||||
static final String fileCache = "E:\\";
|
static final String fileCache = "E:\\";
|
||||||
|
|
||||||
@@ -74,8 +74,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
static final String categoryMapping = "resources/Media_Assistant_Categories_131017_EDITED_without_archive.csv";
|
static final String categoryMapping = "resources/Media_Assistant_Categories_131017_EDITED_without_archive.csv";
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
// static final String entryListPath = "resources/entrylist_2017-10-25.txt";
|
static final String entryListPath = "resources/entrylist_2017-10-25.txt";
|
||||||
static final String entryListPath = "resources/lottery.txt";
|
// static final String entryListPath = "resources/lottery.txt";
|
||||||
|
|
||||||
@Value("${mam.auth}")
|
@Value("${mam.auth}")
|
||||||
private String mamAuth;
|
private String mamAuth;
|
||||||
@@ -140,9 +140,9 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
for (int id : entrySelection) {
|
for (int id : entrySelection) {
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
// if needed start from a certain ID
|
// // if needed start from a certain ID
|
||||||
if (id > 70746)
|
// if (id == 70440)
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
HashSet<String> campaignGuids = new HashSet<String>();
|
HashSet<String> campaignGuids = new HashSet<String>();
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
record.addClassification("Migration.Test");
|
// record.addClassification("Migration.Test");
|
||||||
|
|
||||||
// globally applicable classifications
|
// globally applicable classifications
|
||||||
record.addClassification("Migration");
|
record.addClassification("Migration");
|
||||||
@@ -244,7 +244,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
// Status "Released" is weaker than the other statuses
|
// Status "Released" is weaker than the other statuses
|
||||||
if (p.startsWith("Status.")) {
|
if (p.startsWith("Status.")) {
|
||||||
if (p.equals("Status.Released") && record.hasClassificationStartingWith("Status.")) {
|
if (p.equals("Status.Released") && record.hasClassificationStartingWith("Status.")) {
|
||||||
log.warn("Classification " + p + " not added, different status already set");
|
if (!record.hasClassificationStartingWith("Status.Released"))
|
||||||
|
log.warn("Classification " + p + " not added, different status already set");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -255,7 +256,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
// Business unit "General" is weaker than the other business units
|
// Business unit "General" is weaker than the other business units
|
||||||
if (p.startsWith("BusinessUnit.")) {
|
if (p.startsWith("BusinessUnit.")) {
|
||||||
if (p.equals("BusinessUnit.General") && record.hasClassificationStartingWith("BusinessUnit.")) {
|
if (p.equals("BusinessUnit.General") && record.hasClassificationStartingWith("BusinessUnit.")) {
|
||||||
log.warn("Classification " + p + " not added, different business unit already set");
|
if (!record.hasClassificationStartingWith("BusinessUnit.General"))
|
||||||
|
log.warn("Classification " + p + " not added, different business unit already set");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -265,16 +267,16 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
|
|
||||||
// Brands "General" and "Others" are weaker than the other brands
|
// Brands "General" and "Others" are weaker than the other brands
|
||||||
if (p.startsWith("Brand.")) {
|
if (p.startsWith("Brand.")) {
|
||||||
if ((p.equals("Brand.General") || p.equals("Brand.CAP.Others") || p.equals("Brand.FAP.Others"))
|
// if ((p.equals("Brand.General") || p.equals("Brand.CAP.Others") || p.equals("Brand.FAP.Others"))
|
||||||
&& record.hasClassificationStartingWith("Brand.")) {
|
// && record.hasClassificationStartingWith("Brand.")) {
|
||||||
|
//
|
||||||
// Check if the brand matches the business unit
|
// // FIXME Check if the brand matches the business unit
|
||||||
if (record.hasClassificationStartingWith("Brand.General")
|
// if (record.hasClassificationStartingWith("Brand.General")
|
||||||
&& !record.hasClassificationStartingWith("BusinessUnit.General")) {
|
// && !record.hasClassificationStartingWith("BusinessUnit.General")) {
|
||||||
log.warn("Classification " + p + " not added, different brand already set");
|
// log.warn("Classification " + p + " not added, different brand already set");
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
record.removeClassificationsStartingWith("Brand.");
|
record.removeClassificationsStartingWith("Brand.");
|
||||||
currentBrand = p.substring(p.lastIndexOf('.'));
|
currentBrand = p.substring(p.lastIndexOf('.'));
|
||||||
@@ -510,12 +512,10 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
catch (HttpStatusCodeException hsce) {
|
catch (HttpStatusCodeException hsce) {
|
||||||
log.error("RESULT Skipping entry " + entry.id + ": Error while creating record " + hsce.getStatusCode().toString());
|
log.error("RESULT Skipping entry " + entry.id + ": Error while creating record " + hsce.getStatusCode().toString());
|
||||||
log.error(hsce.getResponseBodyAsString());
|
log.error(hsce.getResponseBodyAsString());
|
||||||
log.error(hsce.getRootCause().toString());
|
|
||||||
hsce.printStackTrace();
|
hsce.printStackTrace();
|
||||||
}
|
}
|
||||||
catch (ResourceAccessException rae) {
|
catch (ResourceAccessException rae) {
|
||||||
log.error("RESULT Could not create record for entry " + entry.id + ": " + rae.getMessage());
|
log.error("RESULT Could not create record for entry " + entry.id + ": " + rae.getMessage());
|
||||||
log.error(rae.getRootCause().toString());
|
|
||||||
rae.printStackTrace();
|
rae.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -591,7 +591,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
new HttpEntity<MultiValueMap<String, Object>>(parameters, adamUploadHeaders), UploadResult.class).getBody();
|
new HttpEntity<MultiValueMap<String, Object>>(parameters, adamUploadHeaders), UploadResult.class).getBody();
|
||||||
|
|
||||||
if (result.token != null) {
|
if (result.token != null) {
|
||||||
log.debug("Storing upload token " + result.token);
|
log.debug("Storing upload token " + result.token + "(" + isMaster + ") for " + recordLocation + " from entry " + entry.id);
|
||||||
UploadReference reference = new UploadReference();
|
UploadReference reference = new UploadReference();
|
||||||
reference.targetRecord = recordLocation;
|
reference.targetRecord = recordLocation;
|
||||||
reference.isMaster = isMaster;
|
reference.isMaster = isMaster;
|
||||||
@@ -600,7 +600,7 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
openUploads.add(reference);
|
openUploads.add(reference);
|
||||||
}
|
}
|
||||||
else if (result.uri != null) {
|
else if (result.uri != null) {
|
||||||
log.debug("Storing upload reference " + result.uri);
|
log.debug("Storing upload reference " + result.uri + "(" + isMaster + ") for " + recordLocation + " from entry " + entry.id);
|
||||||
UploadReference reference = new UploadReference();
|
UploadReference reference = new UploadReference();
|
||||||
reference.targetRecord = recordLocation;
|
reference.targetRecord = recordLocation;
|
||||||
reference.isMaster = isMaster;
|
reference.isMaster = isMaster;
|
||||||
@@ -615,7 +615,6 @@ public class MamMigrationSelective implements CommandLineRunner {
|
|||||||
}
|
}
|
||||||
catch (ResourceAccessException rae) {
|
catch (ResourceAccessException rae) {
|
||||||
log.error("Could not upload " + file.getAbsolutePath() + "(" + isMaster + ") for " + recordLocation + " from entry " + entry.id + ": " + rae.getMessage());
|
log.error("Could not upload " + file.getAbsolutePath() + "(" + isMaster + ") for " + recordLocation + " from entry " + entry.id + ": " + rae.getMessage());
|
||||||
log.error(rae.getRootCause().toString());
|
|
||||||
rae.printStackTrace();
|
rae.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user