}
public SbiKpiError toSbiKpiError(DatasetException dsException, Integer modelInstanceId, String parameters, Session session){
logger.debug("IN");
SbiKpiError sbiKpiError = new SbiKpiError();
sbiKpiError.setUserMessage(dsException.getUserMessage());
sbiKpiError.setFullMessage(dsException.getFullMessage());
SbiKpiModelInst sbiKpiModelInst = (SbiKpiModelInst)session.load(SbiKpiModelInst.class, modelInstanceId);
sbiKpiError.setSbiKpiModelInst(sbiKpiModelInst);
if(sbiKpiModelInst != null){
sbiKpiError.setLabelModInst(sbiKpiModelInst.getLabel());
}
sbiKpiError.setTsDate(new Date());
sbiKpiError.setParameters(parameters);
logger.debug("OUT");
return sbiKpiError;
}