Commit 42fb5d46 authored by Pierre-Yves Gibello's avatar Pierre-Yves Gibello
Browse files

Fixed names normalization (MKT_*)

parent e9bb3385
......@@ -33,7 +33,7 @@ public class MKTXmlHandler extends DataHandler {
case XMLEvent.START_ELEMENT:
if("attribute".equalsIgnoreCase(xmlsr.getLocalName())) {
if("prettyName".equals(xmlsr.getAttributeValue(0)))
name = normalizeName(xmlsr.getAttributeValue(1)); // Extract metric name from <property> element, eg. OMM_TST
name = normalizeName(xmlsr.getAttributeValue(1)); // Extract metric name from <prettyName> element, eg. MKT_Product
} else if("value".equalsIgnoreCase(xmlsr.getLocalName())) {
inValue = true;
}
......@@ -88,11 +88,22 @@ public class MKTXmlHandler extends DataHandler {
*/
private String normalizeName(String name) {
if(name != null) {
name = name.trim();
if(name.length() >= 2)
return "MKT_" + Character.toUpperCase(name.charAt(0)) + name.substring(1).toLowerCase();
else
return "MKT_" + name.toUpperCase();
name = name.toLowerCase();
if(name.contains("product")) {
return "MKT_Product";
} else if(name.contains("community")) {
return "MKT_Community";
} else if(name.contains("support")) {
return "MKT_Support";
} else if(name.contains("customer")) {
return "MKT_Customers";
} else if(name.contains("sales")) {
return "MKT_Sales";
} else if(name.contains("financial")) {
return "MKT_Finances";
} else if(name.contains("market")) {
return "MKT_Marketing";
} else return null;
}
else return null;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment