presetParams(q, objectId, typeId);
List res = q.list();
for (Object r : res){
Object[] rescolumns = (Object[]) r;
ConstructionDefect cd = new ConstructionDefect(
(Integer) rescolumns[0], (String) rescolumns[1]);
DefectType dt = new DefectType(
(Integer) rescolumns[2], (String) rescolumns[3]);
DefectVarity dv = new DefectVarity(
(Integer) rescolumns[4], (String) rescolumns[5]);
DefectZone dz = new DefectZone(
(Integer) rescolumns[6], (String) rescolumns[7]);
cd.setDefectType(dt);
cd.setDefectVarity(dv);
cd.setDefectZone(dz);
cd.setDangerCategory((DangerCategory)rescolumns[8]);
ConstructionExample ce =
ceMap.get((Integer) rescolumns[9]);
if (ce != null) {
if (compareDangerCategory(cd.getDangerCategory(), ce.getRecommendedDangerCategory()) > 0){
ce.setRecommendedDangerCategory(cd.getDangerCategory());
}
ce.getExampleDefects().add(cd);
System.out.println("EXample defects size:"+ce.getExampleDefects().size());
ce.setDefectCount(new Integer(ce.getExampleDefects().size()));
}