} else if (serviceType != null && serviceType.equalsIgnoreCase(TRESHOLDS_LIST)) {
Integer id = getAttributeAsInteger(ID);
try {
if(id != null){
IThresholdValueDAO tresholdDao = DAOFactory.getThresholdValueDAO();
IKpiInstanceDAO kpiDao = DAOFactory.getKpiInstanceDAO();
KpiInstance k = kpiDao.loadKpiInstanceById(id);
if(k!=null){
List<ThresholdValue> tresholds = tresholdDao.loadThresholdValuesByThresholdId(k.getThresholdId());
logger.debug("Threshold values loaded");
JSONArray trshJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(tresholds,locale);
JSONObject trashResponseJSON = createJSONResponseThresholds(trshJSON);
writeBackToClient(new JSONSuccess(trashResponseJSON));
}else{
writeBackToClient("Error");
}
}
} catch (Throwable e) {
logger.error("Exception occurred while retrieving tresholds", e);
throw new SpagoBIServiceException(SERVICE_NAME,
"Exception occurred while retrieving tresholds",e);
}
}else if(serviceType == null){
try {
IKpiInstanceDAO kpiDao = DAOFactory.getKpiInstanceDAO();
List<String> kpis = (List<String>)getSessionContainer().getAttribute(KPI_LIST);
if(kpis != null){
getSessionContainer().delAttribute(KPI_LIST);
}
List<KpiAlarmInstance> kpisAlarm = kpiDao.loadKpiAlarmInstances();
if(kpisAlarm != null){
getSessionContainer().setAttribute(KPI_LIST, kpisAlarm);
}
List<SbiAlarmContact> contactsList = DAOFactory.getAlarmContactDAO().findAll();