}
public Resolution submit() {
IProbaDao probaDao = new ProbaDao();
Proba proba = probaDao.geProbaByID(Integer.parseInt(getContext().getRequest().getSession().getAttribute("idProba").toString()));
//sa populeze comboboxurile
ICompresibilitateDao compresibilitateDao = new CompresibilitateDao();
List<Float> sarciniL = compresibilitateDao.geSarciniByIDProba(proba.getIdProba());
setSarcini(sarciniL);
String sigma = getSarcina1() + "-" + getSarcina2();
ICompresiuneDao compresiuneDao = new CompresiuneDao();
Compresiune compresiune = new Compresiune(proba, sigma);
List<Compresiune> compresiuneAuxiliar = compresiuneDao.geCompresiuneByIDProba(proba.getIdProba());
if (compresiuneAuxiliar == null) {
compresiuneDao.saveOrUpdate(compresiune);
} else {
int vb = 0;
Iterator it = compresiuneAuxiliar.iterator();
while (it.hasNext()) {
Compresiune c = (Compresiune) it.next();
if (c.getSigma().equals(sigma)) {
vb = 1;
compresiune.setIdCompresiune(c.getIdCompresiune());
compresiuneDao.saveOrUpdate(compresiune);
break;
}
}
if (vb == 0) {
compresiuneDao.saveOrUpdate(compresiune);
}
}
List<Compresiune> compresiuni = compresiuneDao.geCompresiuneByIDProba(proba.getIdProba());
List<String> sigmaList = new ArrayList<String>();
Iterator it = compresiuni.iterator();
while (it.hasNext()) {
sigmaList.add(((Compresiune) it.next()).getSigma());
}
CompresiuneTabel compTabel = new CompresiuneTabel();
compTabel.setC1(sigmaList);
compTabel.setC2(formulaCompresiuneCol2(sigmaList, proba.getIdProba()));
compTabel.setC3(formulaCompresiuneCol3(sigmaList, proba.getIdProba()));
compTabel.setC4(formulaCompresiuneCol4(sigmaList, proba.getIdProba()));
compTabel.setC5(formulaCompresiuneCol5(sigmaList, proba.getIdProba()));
compTabel.setC6(formulaCompresiuneCol6(sigmaList, proba.getIdProba()));
compTabel.setC7(formulaCompresiuneCol7(sigmaList, proba.getIdProba()));
compTabel.setC8(formulaCompresiuneCol8(sigmaList, proba.getIdProba()));
compTabel.setC9(formulaCompresiuneCol9(sigmaList, proba.getIdProba()));
compTabel.setC10(formulaCompresiuneCol10(sigmaList, proba.getIdProba()));
getContext().getRequest().getSession(true).setAttribute("compresiune", compTabel);
return new ForwardResolution("/WEB-INF/jsp/compresiune.jsp");
}