if (extractDefectTypeParam(request).equals("simple")) {
boolean hasFatalError = false;
try {
ConstructionDefect constructionDefect = constructionDefectManager.getConstructionDefect(constructionDefectId);
ConstructionExample constructionExample = constructionExampleManager.getConstructionExample(constructionDefect.getExampleId().toString());
constructionExample.getExampleDefects().remove(constructionDefect);
constructionExampleManager.saveConstructionExample(constructionExample);
request.getSession().setAttribute("madeChanges", new Boolean(true));
request.setAttribute("message", bundle.getString("constructionDefect.deleted"));
ObjectConstruction objectConstruction = objectConstructionManager.getObjectConstruction(constructionExample.getObjectConstructionId().toString());
try {
doDeleteDefectSymbols(request, objectConstruction.getWayToDefectMap(),
constructionDefect);
} catch (IOException e) {
}
} catch (Exception e) {
hasFatalError = true;
}
if (hasFatalError) {
request.setAttribute("errormessage", bundle.getString("commonMistake"));
}
} else if (extractDefectTypeParam(request).equals("zone")) {
ConstructionDefectZone constructionDefect = constructionDefectManager.getConstructionDefectZone(constructionDefectId);
ConstructionExample constructionExample = constructionExampleManager.getConstructionExample(constructionDefect.getExampleId().toString());
constructionExample.getExampleDefectsZone().remove(constructionDefect);
constructionExampleManager.saveConstructionExample(constructionExample);
constructionDefectManager.deleteConstructionDefectZone(constructionDefect);
request.getSession().setAttribute("madeChanges", new Boolean(true));
request.setAttribute("message", bundle.getString("constructionDefect.deleted"));