SourceBean measureSB;
SourceBean tresholdsSB;
SourceBean coloursSB;
List paramList;
SourceBean paramSB;
Measure measure;
String attributeValue;
measures = new HashMap();
measureList = measuresConfigurationSB.getAttributeAsList("KPI");
for(int i = 0; i < measureList.size(); i++) {
measureSB = (SourceBean)measureList.get(i);
measure = new Measure();
attributeValue = (String)measureSB.getAttribute("column_id");
measure.setColumnId(attributeValue);
attributeValue = (String)measureSB.getAttribute("description");
measure.setDescription(attributeValue);
attributeValue = (String)measureSB.getAttribute("agg_func");
if(attributeValue == null) attributeValue = "sum";
measure.setAggFunc(attributeValue);
attributeValue = (String)measureSB.getAttribute("colour");
measure.setColour(attributeValue);
attributeValue = (String)measureSB.getAttribute("pattern");
measure.setPattern(attributeValue);
attributeValue = (String)measureSB.getAttribute("unit");
measure.setUnit(attributeValue);
tresholdsSB = (SourceBean)measureSB.getAttribute("TRESHOLDS");
attributeValue = (String)tresholdsSB.getAttribute("lb_value");
measure.setTresholdLb(attributeValue);
attributeValue = (String)tresholdsSB.getAttribute("ub_value");
measure.setTresholdUb(attributeValue);
attributeValue = (String)tresholdsSB.getAttribute("type");
measure.setTresholdCalculatorType(attributeValue);
paramList = tresholdsSB.getAttributeAsList("PARAM");
Properties tresholdCalculatorParameters = new Properties();
for(int j = 0; j < paramList.size(); j++) {
paramSB = (SourceBean)paramList.get(j);
String pName = (String)paramSB.getAttribute("name");
String pValue = (String)paramSB.getAttribute("value");
tresholdCalculatorParameters.setProperty(pName, pValue);
}
measure.setTresholdCalculatorParameters(tresholdCalculatorParameters);
coloursSB = (SourceBean)measureSB.getAttribute("COLOURS");
attributeValue = (String)coloursSB.getAttribute("null_values_color");
measure.setColurNullCol(attributeValue);
attributeValue = (String)coloursSB.getAttribute("outbound_colour");
measure.setColurOutboundCol(attributeValue);
attributeValue = (String)coloursSB.getAttribute("type");
measure.setColurCalculatorType(attributeValue);
paramList = coloursSB.getAttributeAsList("PARAM");
Properties colurCalculatorParameters = new Properties();
for(int j = 0; j < paramList.size(); j++) {
paramSB = (SourceBean)paramList.get(j);
String pName = (String)paramSB.getAttribute("name");
String pValue = (String)paramSB.getAttribute("value");
colurCalculatorParameters.setProperty(pName, pValue);
}
measure.setColurCalculatorParameters(colurCalculatorParameters);
measures.put(measure.getColumnId().toUpperCase(), measure);
}
return measures;
}