if(isValuable(name) && isValuable(msg) && isValuable(email) && isValuable(client) && isValuable(menuKey)) {
final Key key = KeyFactory.stringToKey(menuKey);
if(menuDAO.isMenuKey(key)) {
final Comment comment = new Comment();
final UserDAO userDAO = new UserDAO();
User user = userDAO.getUserViaMail(email);
if(user == null) {
user = new User();
user.setEmail(email);
user.setName(name);
}
comment.setUser(user);
DateTime dateTime = new DateTime(DateTimeZone.forTimeZone(CalendarUtil.getCalendar().getTimeZone()));
comment.setTimestamp(dateTime.getMillis());
comment.setMenuKey(key);
comment.setText(msg);
comment.setClient(client);
comment.setIsRating(false);
commentDAO.saveComment(comment);
}
}
}