log.debug("entering 'handleRequest' method...");
}
String objectConstructionId = request.getParameter("objectConstructionId");
if (objectConstructionId != null) {
ObjectConstruction objectConstruction = objectConstructionManager.getObjectConstruction(objectConstructionId);
if (objectConstruction.getWayToEsckiz() != null && !"".equals(objectConstruction.getWayToEsckiz()) && objectConstruction.getEsckizBlob() != null && objectConstruction.getEsckizBlob().length() > 0) {
File file = new File(FileHelper.getCurrentPath(request) + objectConstruction.getWayToEsckiz());
if (file.exists()) {
file.delete();
}
file.createNewFile();
FileOutputStream fileOutputStream = new FileOutputStream(FileHelper.getCurrentPath(request) + objectConstruction.getWayToEsckiz());
Blob blob = objectConstruction.getEsckizBlob();
byte[] bufer = new byte[62000];
InputStream inputStream = blob.getBinaryStream();
while (inputStream.read(bufer) != -1) {
fileOutputStream.write(bufer);
}
inputStream.close();
fileOutputStream.close();
} else {
request.setAttribute("noPhoto", "true");
}
return new ModelAndView("objectConstructionPicture", Constants.OBJECTCONSTRUCTIONTYPE_WAY, objectConstruction.getWayToEsckiz());
} else {
request.setAttribute("noObjectConstruction", "true");
}
return new ModelAndView("objectConstructionPicture");