break;
}
}
if (form.isSiteProfileClassDefault()) {
ItemImage itemImage = new ItemImage();
itemImage.setImageName(file.getFileName());
itemImage.setContentType("image/jpeg");
itemImage.setImageValue(scaler.getBytes());
itemImage.setImageHeight(scaler.getHeight());
itemImage.setImageWidth(scaler.getWidth());
itemImage.setRecUpdateBy(adminBean.getUser().getUserId());
itemImage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
itemImage.setRecCreateBy(adminBean.getUser().getUserId());
itemImage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
em.persist(itemImage);
if (itemLanguage.getImage() == null) {
itemLanguage.setImage(itemImage);
}
else {
itemImage.setItemLanguage(itemLanguage);
itemLanguage.getImages().add(itemImage);
}
itemLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
itemLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
em.persist(itemLanguage);
}
else {
if (itemLanguage == null) {
itemLanguage = new ItemLanguage();
itemLanguage.setItem(item);
itemLanguage.setRecCreateBy(adminBean.getUser().getUserId());
itemLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(form.getSiteProfileClassId());
itemLanguage.setSiteProfileClass(siteProfileClass);
}
ItemImage itemImage = new ItemImage();
itemImage.setImageName(file.getFileName());
itemImage.setContentType("image/jpeg");
itemImage.setImageValue(scaler.getBytes());
itemImage.setImageHeight(scaler.getHeight());
itemImage.setImageWidth(scaler.getWidth());
itemImage.setRecUpdateBy(adminBean.getUser().getUserId());
itemImage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
itemImage.setRecCreateBy(adminBean.getUser().getUserId());
itemImage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
em.persist(itemImage);
if (itemLanguage.getImage() == null) {
itemLanguage.setImage(itemImage);
}
else {
itemImage.setItemLanguage(itemLanguage);
itemLanguage.getImages().add(itemImage);
}
itemLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
itemLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
em.persist(itemImage);