"redirect:objectConstructions.html?objectId="
+ buildObjectId + "&typeId=" + typeId);
}
if (exampleNumber > 0) {
ConstructionExample constructionExample = new ConstructionExample();
// generating the unique number of construction
constructionExample.setExampleName("конструкция 0");
System.out.println(objectConstruction.getTypeId().intValue());
Integer number = constructionExampleManager.getExampleNumberByConstructionObjectId(new Integer(objectConstruction.getTypeId()));
constructionExample.setExampleRelativeNumber(number);
DangerCategory dc = new DangerCategory();
// 0 -default danger category means N/A
dc.setDangerCategoryId(new Integer(0));
constructionExample.setDangerCategory(dc);
constructionExample.setObjectId(new Integer(buildObjectId));
constructionExample.setBuildObjectId(new Integer(buildObjectId));
constructionExample.setObjectConstructionId(objectConstruction.getTypeId());
constructionExample.setConstructionType(objectConstruction.getConstructionType());
constructionExample.setRecommendedDangerCategory(null);
constructionExample.setParent(objectConstruction);
// setting the ways to esciz
// checking esciz
if (constructionExample.getWayToDefectEsckiz() == null
|| constructionExample.getWayToDefectEsckiz().equals("")) {
// retrieving esciz from object construction
Blob eskiz = objectConstructionManager
.getObjectConstructionImage(new Integer(typeId),"eskiz");
// esciz for defects
if (eskiz != null) {
String wayToDefectEskiz = "eskiz"
+ (System.currentTimeMillis() & 0xffffffffL)
+ ".jpg";
constructionExample.setDefectEsckizBlob(eskiz);
constructionExample
.setWayToDefectEsckiz(wayToDefectEskiz);
constructionExample.setDefectEsckizWayImage("image"
+ wayToDefectEskiz);
// esciz for power points
String wayToPowerEskiz = "powereskiz"
+ (System.currentTimeMillis() & 0xffffffffL)
+ ".jpg";
constructionExample
.setWayToPowerEsckiz(wayToPowerEskiz);
constructionExample.setPowerEsckizBlob(eskiz);
constructionExample.setPowerEsckizWayImage("image"
+ wayToPowerEskiz);
}
}
constructionExampleManager
.saveConstructionExample(constructionExample);
constructionExampleManager.copyExample(
constructionExample.getExampleId(), exampleNumber - 1);
Cookie cookie = new Cookie("nodeEnsureVisible", ""
+ (new java.util.Date().getTime()));
cookie.setValue(String.valueOf(number));
cookie.setMaxAge(30 * 24 * 60 * 60);
response.addCookie(cookie);