Special rules for brand mapping

This commit is contained in:
gexce
2017-08-16 10:05:55 +02:00
parent d86c1e6d1d
commit c78f9bb0a4
@@ -299,19 +299,19 @@ public class ToolboxImportFileGenerator {
brandMap.put("Wolverine PowerPak", "Wolverine Advanced"); brandMap.put("Wolverine PowerPak", "Wolverine Advanced");
brandMap.put("Yield Shield", "TEMPORARY"); brandMap.put("Yield Shield", "TEMPORARY");
// TODO to be checked by business // XXX additional mappings
brandMap.put("NULL", "TEMPORARY"); // Bayer/General? brandMap.put("NULL", "TEMPORARY"); // Bayer/General?
brandMap.put("131-Kote", "TEMPORARY"); brandMap.put("131-Kote", "TEMPORARY");
brandMap.put("Cotgard", "TEMPORARY");
brandMap.put("Fluency Agent/Fluency Agent Advanced", "TEMPORARY"); // --> set both brands via special rule
brandMap.put("ICP - Food Chain", "Bayer/General"); brandMap.put("ICP - Food Chain", "Bayer/General");
brandMap.put("ICP - Fruit", "Bayer/General"); brandMap.put("ICP - Fruit", "Bayer/General");
brandMap.put("ICP-Programs", "Bayer/General"); brandMap.put("ICP-Programs", "Bayer/General");
brandMap.put("ICP - Veg/Potato", "Bayer/General"); brandMap.put("ICP - Veg/Potato", "Bayer/General");
brandMap.put("Poncho/VOTiVO 2", "TEMPORARY"); // set both 'Poncho' and 'Votivo' via special rule
brandMap.put("Poncho 1250/VOTiVO 2", "TEMPORARY"); // set 'Poncho 250/1250' and 'Votivo' via special rule (there is no Votivo 2)
brandMap.put("Velum", "Velum One"); brandMap.put("Velum", "Velum One");
brandMap.put("Velum Prime 3", "Velum Prime"); brandMap.put("Velum Prime 3", "Velum Prime");
brandMap.put("Fluency Agent/Fluency Agent Advanced", "TEMPORARY"); // set both brands via special rule
brandMap.put("Poncho/VOTiVO 2", "TEMPORARY"); // set both 'Poncho' and 'Votivo' via special rule
brandMap.put("Poncho 1250/VOTiVO 2", "TEMPORARY"); // set 'Poncho 250/1250' and 'Votivo' via special rule (there is no Votivo 2)
unitMap = new HashMap<String, String>(); unitMap = new HashMap<String, String>();
unitMap.put("Bayer/General", "Crop Protection"); unitMap.put("Bayer/General", "Crop Protection");
@@ -1108,8 +1108,25 @@ public class ToolboxImportFileGenerator {
assets.put(assetId, asset); assets.put(assetId, asset);
} }
asset.brands.add(brandMap.get(line[14])); // Special rules for brands
if (line[14].equals("Fluency Agent/Fluency Agent Advanced")) {
asset.brands.add(brandMap.get("Fluency Agent"));
asset.brands.add(brandMap.get("Fluency Agent Advanced"));
}
else if (line[14].equals("Poncho/VOTiVO 2")) {
asset.brands.add(brandMap.get("Poncho"));
asset.brands.add(brandMap.get("Votivo"));
}
else if (line[14].equals("Poncho 1250/VOTiVO 2")) {
asset.brands.add(brandMap.get("Poncho 1250"));
asset.brands.add(brandMap.get("Votivo"));
}
else {
// default
asset.brands.add(brandMap.get(line[14]));
}
if (asset.byr_cs_businessUnit == null) { if (asset.byr_cs_businessUnit == null) {
asset.byr_cs_businessUnit = unitMap.get(brandMap.get(line[14])); asset.byr_cs_businessUnit = unitMap.get(brandMap.get(line[14]));
} }
@@ -1122,9 +1139,9 @@ public class ToolboxImportFileGenerator {
assignedBrands += brand; assignedBrands += brand;
} }
log.error("Asset " + asset.toolboxAssetId + ": Additional brand " + brandMap.get(line[14]) + " (" // log.error("Asset " + asset.toolboxAssetId + ": Additional brand " + brandMap.get(line[14]) + " ("
+ unitMap.get(brandMap.get(line[14])) + ") does not belong to business unit " + asset.byr_cs_businessUnit // + unitMap.get(brandMap.get(line[14])) + ") does not belong to business unit " + asset.byr_cs_businessUnit
+ " of already assigned brand(s) " + assignedBrands); // + " of already assigned brand(s) " + assignedBrands);
} }
// Indications stored in POJO for reference only. Indications are added to classifications in readToolboxExport() // Indications stored in POJO for reference only. Indications are added to classifications in readToolboxExport()