@Override
 public String generateLogin(User user) {
   StringBuilder login = new StringBuilder(user.getName().replace(" ", "").toLowerCase());
   login = UserUtils.transliterate(login);
   int i = 1;
   while (userDao.checkLogin(login.toString())) {
     login.append(i++);
   }
   return login.toString();
 }
Esempio n. 2
0
 @Override
 @Transactional
 public void updateUser(User user) {
   Session session = sessionFactory.getCurrentSession();
   User user4Update = (User) session.get(User.class, user.getId());
   user4Update.setName(user.getName());
   user4Update.setLogin(user.getLogin());
   user4Update.setTelNumber(user.getTelNumber());
   user4Update.setDateOfBirth(user.getDateOfBirth());
   user4Update.setAccess(user.getAccess());
   user4Update.setActive(user.isActive());
   session.save(user4Update);
 }