boolean isDsConfDefined = false;
String confDataset = "";
// get all the parameters for dash configuration
confParameters = new LinkedHashMap();
SourceBean confSB = (SourceBean) content.getAttribute("CONF");
List confAttrsList = confSB.getContainedSourceBeanAttributes();
Iterator confAttrsIter = confAttrsList.iterator();
while (confAttrsIter.hasNext()) {
SourceBeanAttribute paramSBA = (SourceBeanAttribute) confAttrsIter.next();
SourceBean param = (SourceBean) paramSBA.getValue();
String nameParam = (String) param.getAttribute("name");
String valueParam = replaceParsInString((String) param.getAttribute("value"));
confParameters.put(nameParam, valueParam);
}
//defines if configuration is by dataset
if(confParameters.get("confdataset")!=null && !(((String)confParameters.get("confdataset")).equalsIgnoreCase("") )){
confDataset=(String)confParameters.get("confdataset");
isDsConfDefined=true;
}
else {
isDsConfDefined=false;
}
//if the configuration is by dataset reading it and compiles attributes with its values.
if(isDsConfDefined){
logger.debug("configuration defined in dataset "+confDataset);
String parameters=DataSetAccessFunctions.getDataSetResultFromLabel(profile, confDataset, dataParameters);
SourceBean sourceBeanResult=null;
try {
sourceBeanResult = SourceBean.fromXMLString(parameters);
} catch (SourceBeanException e) {
logger.error("error in reading configuration lov");
throw new Exception("error in reading configuration lov");
}
confParameters = new LinkedHashMap();
SourceBean sbRow=(SourceBean)sourceBeanResult.getAttribute("ROW");
confParameters.put("minValue", (String)sbRow.getAttribute("minValue"));
confParameters.put("maxValue", (String)sbRow.getAttribute("maxValue"));
confParameters.put("lowValue", (String)sbRow.getAttribute("lowValue"));
confParameters.put("highValue", (String)sbRow.getAttribute("highValue"));
confParameters.put("refreshRate", (String)sbRow.getAttribute("refreshRate"));
confParameters.put("multichart", (String)sbRow.getAttribute("multichart"));
confParameters.put("numCharts", (String)sbRow.getAttribute("numCharts"));
confParameters.put("orientation_multichart", (String)sbRow.getAttribute("orientation_multichart"));
//defining title and legend variables
confParameters.put("displayTitleBar", (String)sbRow.getAttribute("displayTitleBar"));
confParameters.put("title", replaceParsInString((String)sbRow.getAttribute("title")));
confParameters.put("colorTitle", (String)sbRow.getAttribute("colorTitle"));
confParameters.put("sizeTitle", (String)sbRow.getAttribute("sizeTitle"));
confParameters.put("fontTitle", (String)sbRow.getAttribute("fontTitle"));
confParameters.put("colocolorTitleSerierTitle", (String)sbRow.getAttribute("colorTitleSerie"));
confParameters.put("sizeTitleSerie", (String)sbRow.getAttribute("sizeTitleSerie"));
confParameters.put("fontTitleSerie", (String)sbRow.getAttribute("fontTitleSerie"));
confParameters.put("legend", (String)sbRow.getAttribute("legend"));
String strNeedles = (String)sbRow.getAttribute("numNeedles");
confParameters.put("numNeedles",strNeedles);
int numNeedles = 0;
try{
numNeedles = Integer.parseInt(strNeedles);
}catch(Exception e){
logger.error("error in reading configuration dataset. Number of needles is invalid." );
throw new Exception("error in reading configuration dataset. Number of needles is invalid.");
}
for (int i=0 ; i < numNeedles; i++){
confParameters.put("colorNeedle"+(i+1), (String)sbRow.getAttribute("colorNeedle"+(i+1)));
confParameters.put("value"+(i+1), (String)sbRow.getAttribute("value"+(i+1)));
}
}
else
logger.debug("Configuration set in template");