/** * Convenience method to send e-mail to users * * @param user the user to send to * @param msg the message to send * @param url the URL to the application (or where ever you'd like to send them) */ protected void sendUserMessage(SysUserEntity user, String msg, String url) { if (log.isDebugEnabled()) { log.debug("sending e-mail to user [" + user.getEmail() + "]..."); } mailMessage.setTo(user.getFullName() + "<" + user.getEmail() + ">"); Map<String, Object> model = new HashMap<String, Object>(); model.put("user", user); // TODO: figure out how to get bundle specified in struts.xml // model.put("bundle", getTexts()); model.put("message", msg); model.put("applicationURL", url); mailEngine.sendMessage(mailMessage, templateName, model); }
/** {@inheritDoc} */ public SysUserEntity saveUser(SysUserEntity user) { if (log.isDebugEnabled()) { log.debug("user's id: " + user.getId()); } getSession().saveOrUpdate(user); // necessary to throw a DataIntegrityViolation and catch it in UserManager getSession().flush(); return user; }