private void prepareConstructionTypesForView(HttpServletRequest request, HttpServletResponse response){
List constructionTypes = constructionTypeManager.getConstructionTypes(null);
List constructionTypeDTOList = new ArrayList();
for (int i = 0; i < constructionTypes.size(); i++) {
ConstructionType constructionType = (ConstructionType) constructionTypes.get(i);
ConstructionTypeDTO constructionTypeDTO = new ConstructionTypeDTO(constructionType);
constructionTypeDTOList.add(constructionTypeDTO);
List defectZoneList = constructionType.getDefectZones();
List defectZoneDTOList = new ArrayList();
for (int j = 0; j < defectZoneList.size(); j++) {
DefectZoneDTO defectZoneDTO = new DefectZoneDTO((DefectZone) defectZoneList.get(j));
defectZoneDTOList.add(defectZoneDTO);
List defectCategoryDTOList = new ArrayList();
List defectCategoryList = defectCategoryManager.getDefectCategorysByConstructionTypeIdDefectZoneId(constructionTypeDTO.getConstructionTypeId().toString(), defectZoneDTO.getDefectZoneId().toString());
for (int k = 0; k < defectCategoryList.size(); k++) {
DefectCategory defectCategory = (DefectCategory) defectCategoryList.get(k);
DefectCategoryDTO defectCategoryDTO = new DefectCategoryDTO(defectCategory);
DefectVarity defectVarity = defectCategory.getDefectVarity();
DefectType defectType = defectCategory.getDefectType();
List reasonList = reasonManager.getReasonsByDefectTypeVarityConstructionZone(defectType.getDefectTypeId().toString(), defectVarity.getVarityId().toString(), constructionTypeDTO.getConstructionTypeId().toString(), defectZoneDTO.getDefectZoneId().toString());
// List reasonListDTO=new ArrayList();
// for (int l = 0; l < reasonList.size(); l++) {
// Reason reason = (Reason) reasonListDTO.get(l);
//
//
// }
defectCategoryDTO.setReasons(reasonList);
defectCategoryDTOList.add(defectCategoryDTO);
}
defectZoneDTO.setDefectCategories(defectCategoryDTOList);
}
constructionTypeDTO.setDefectZones(defectZoneDTOList);
}
request.setAttribute("constructionTypes", constructionTypeDTOList);
}