attributes.put("commentMessage", getLanguage("content.error.string.required"));
}
if (attributes.size() == 0) {
EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
Content content = (Content) ContentDAO.loadNatural(siteDomain.getSite().getSiteId(), contentNaturalKey);
Comment comment = new Comment();
comment.setCommentTitle(commentTitle);
comment.setComment(commentLine);
comment.setCommentRating(0);
comment.setActive(Constants.VALUE_YES);
String custName = customer.getCustEmail();
if (custName.length() > 20) {
custName = custName.substring(0, 19);
}
comment.setRecCreateBy(custName);
comment.setRecCreateDatetime(new Date(System.currentTimeMillis()));
comment.setRecUpdateBy(custName);
comment.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
comment.setCustomer(customer);
comment.setContent(content);
content.getComments().add(comment);
em.persist(comment);
attributes.put("commentTitle", "");
attributes.put("comment", "");
}