for (int i = 0; i < defectTypes.size(); i++) {
DefectType defectType = (DefectType) defectTypes.get(i);
List varityList = defectType.getVarities();
List varityDTOList = new ArrayList();
for (int j = 0; j < varityList.size(); j++) {
DefectVarityDTO defectVarity = new DefectVarityDTO((DefectVarity) varityList.get(j));
//System.out.println("defectVarity"+j);
varityDTOList.add(defectVarity);
List constructionTypeList = constructionTypeManager.getConstructionTypesByDefectVarityAndDefectType(defectVarity.getVarityId().toString(), defectType.getDefectTypeId().toString());
//adding reasons for defect zones
List constructionTypeDTOList = new ArrayList();
for (int k = 0; k < constructionTypeList.size(); k++) {
//System.out.println("constructionType"+k);
ConstructionTypeDTO constructionType = new ConstructionTypeDTO((ConstructionType) constructionTypeList.get(k));
constructionTypeDTOList.add(constructionType);
List defectZones = constructionType.getDefectZones();
List defectZonesDTOList = new ArrayList();
for (int l = 0; l < defectZones.size(); l++) {
//System.out.println("defectZones"+l);
DefectZoneDTO defectZone = new DefectZoneDTO((DefectZone) defectZones.get(l));
defectZonesDTOList.add(defectZone);
defectZone.setReasons(reasonManager.getReasonsByConstructionVarityZone(constructionType.getConstructionTypeId().toString(), defectVarity.getVarityId().toString(), defectZone.getDefectZoneId().toString()));
}
constructionType.setDefectZones(defectZonesDTOList);
//setting defect categories for construction type
List defectCategories = defectCategoryManager.getCategoriesByVarityIdConstructionTypeId(defectVarity.getVarityId().toString(), constructionType.getConstructionTypeId().toString());
List defectCategoryDTOList = new ArrayList();
for (int z = 0; z < defectCategories.size(); z++) {
//System.out.println("defectCategory"+z);
DefectCategoryDTO defectCategory = new DefectCategoryDTO((DefectCategory) defectCategories.get(z));
defectCategoryDTOList.add(defectCategory);
defectCategory.setDefectRecomendations(defectRecomendationManager.getDefectRecomendationsByCategoryIdConstructionTypeId(defectCategory.getDefectCategoryId().toString(), constructionType.getConstructionTypeId().toString()));
}
constructionType.setDefectCategories(defectCategoryDTOList);
}
defectVarity.setConstructionTypes(constructionTypeDTOList);
}
defectType.setVarities(varityDTOList);
}
httpServletRequest.setAttribute("defectTypes", defectTypes);