r = resDao.toResource(res);
logger.debug("SbiKpiValue resource: "
+ (r.getColumn_name() != null ? r.getColumn_name() : "resource name null"));
}
SbiOrgUnit sbiOrgUnit = value.getSbiOrgUnit();
OrganizationalUnit orgUnit = null;
if(sbiOrgUnit != null){
orgUnit = DAOFactory.getOrganizationalUnitDAO().getOrganizationalUnit(sbiOrgUnit.getId());
logger.debug("SbiKpiValue ou: "
+ (orgUnit.getName() != null ? orgUnit.getName()
: "ou name null"));
}
kpiInstanceID = value.getSbiKpiInstance().getIdKpiInstance();
logger.debug("SbiKpiValue kpiInstanceID: "
+ (kpiInstanceID != null ? kpiInstanceID.toString() : "kpiInstanceID null"));
SbiKpiInstance kpiInst = value.getSbiKpiInstance();
List thresholdValues = new ArrayList();
Date kpiInstBegDt = kpiInst.getBeginDt();
logger.debug("kpiInstBegDt begin date: "
+ (kpiInstBegDt != null ? kpiInstBegDt.toString() : "Begin date null"));
// TODO for the moment get actual values of weight/target etc check if it is correct
weight = kpiInst.getWeight();
logger.debug("SbiKpiValue weight: "
+ (weight != null ? weight.toString() : "weight null"));
target = kpiInst.getTarget();
logger.debug("SbiKpiValue target: "
+ (target != null ? target.toString() : "target null"));
if (kpiInst.getSbiMeasureUnit() != null) {
scaleCode = kpiInst.getSbiMeasureUnit().getScaleCd();
logger.debug("SbiKpiValue scaleCode: "
+ (scaleCode != null ? scaleCode : "scaleCode null"));
scaleName = kpiInst.getSbiMeasureUnit().getScaleNm();
logger.debug("SbiKpiValue scaleName: "
+ (scaleName != null ? scaleName : "scaleName null"));
}
SbiThreshold t = kpiInst.getSbiThreshold();
if(t!=null){
Set ts = t.getSbiThresholdValues();
Iterator i = ts.iterator();
while (i.hasNext()) {
SbiThresholdValue tls = (SbiThresholdValue) i.next();
IThresholdValueDAO thDao=(IThresholdValueDAO)DAOFactory.getThresholdValueDAO();
ThresholdValue tr = thDao.toThresholdValue(tls);
thresholdValues.add(tr);
}
}
// TODO for the moment get actual values of weight/target etc check if it is correct
toReturn.setValueDescr(valueDescr);
logger.debug("Kpi value descritpion setted");
toReturn.setTarget(target);
logger.debug("Kpi value target setted");
toReturn.setBeginDate(beginDate);
logger.debug("Kpi value begin date setted");
toReturn.setEndDate(endDate);
logger.debug("Kpi value end date setted");
toReturn.setValue(val);
logger.debug("Kpi value setted");
toReturn.setKpiInstanceId(kpiInstanceID);
logger.debug("Kpi value Instance ID setted");
toReturn.setWeight(weight);
logger.debug("Kpi value weight setted");
toReturn.setR(r);
logger.debug("Kpi value resource setted");
toReturn.setScaleCode(scaleCode);
logger.debug("Kpi value scale Code setted");
toReturn.setScaleName(scaleName);
logger.debug("Kpi value scale Name setted");
toReturn.setThresholdValues(thresholdValues);
logger.debug("Kpi value Thresholds setted");
toReturn.setKpiValueId(value.getIdKpiInstanceValue());
logger.debug("Kpi value ID setted");
toReturn.setValueXml(value.getXmlData());
logger.debug("Kpi value XML setted");
OrganizationalUnitGrantNode grantNode = new OrganizationalUnitGrantNode();
OrganizationalUnitNode node = new OrganizationalUnitNode();
if(value.getSbiOrgUnit() != null){
OrganizationalUnit ou = DAOFactory.getOrganizationalUnitDAO().getOrganizationalUnit(value.getSbiOrgUnit().getId());
node.setOu(ou);
}
if(value.getSbiOrgUnitHierarchies() != null){
OrganizationalUnitHierarchy hierarchy = DAOFactory.getOrganizationalUnitDAO().getHierarchy(value.getSbiOrgUnitHierarchies().getId());
node.setHierarchy(hierarchy);