コード例 #1
0
 public User createUser(final String login, final String password, final String email)
     throws NameClashException, MailException {
   try {
     final UserImpl user = new UserImpl(login, password);
     if (email != null) user.setEmail(email);
     entityManager.persist(user);
     if (email != null) MailSender.sendSignupMail(login, password, email);
     return user;
   } catch (EntityExistsException e) {
     throw new NameClashException();
   }
 }
コード例 #2
0
 public void updateEmail(final User user, final String email) {
   ((UserImpl) user).setEmail(email.length() > 0 ? email : null);
   entityManager.merge(user);
 }