Integer pipeElementId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("pipeElementId")));
mav.addObject("objectId", objectId);
mav.addObject("detailType", detailType);
mav.addObject("pipeElementId", pipeElementId);
DetailDurability detailDurability = (DetailDurability) command;
if (detailDurability.getDurabilityId() != null) {
detailDurabilityManager.update(detailDurability);
return new ModelAndView("redirect:/detailDurabilityList.html?objectId=" + objectId + "&detailType=" + detailType + "&pipeElementId=" + pipeElementId);
} else {
detailDurabilityManager.insert(detailDurability);
PipeLineElement pipeLineElement = pipeLineElementManager.getPipeLineElementById(pipeElementId);
pipeLineElement.getDetailDurabilityList().add(detailDurability);
pipeLineElementManager.update(pipeLineElement);
mav.addObject("result", new Integer(1));
}
DetailDurability detail = new DetailDurability();
detail.setDurabilityUniqueNumber(detailDurabilityManager.getNumber(pipeElementId, FileHelper.getCurrentPath(request)));
mav.addObject("detailDurability", detail);
return mav;
}