@Override public void createNewUser(UserAccount userOne) { Validate.isTrue( userOne.getId() == null, "This method should be called for 'not saved yet' user only. Use UPDATE instead"); LOGGER.debug("Create new: {}", userOne); dao.insert(userOne); }
@Override public List<UserRole> getRoles(Long userId) { return dao.getUserRole(userId); }
@Override public UserAccount getUserByLogin(String userLogin) { final List<UserAccount> allByFieldRestriction = dao.getAllByFieldRestriction(UserAccount_.login, userLogin); return !allByFieldRestriction.isEmpty() ? allByFieldRestriction.get(0) : null; }
@Override public void deleteAll() { LOGGER.debug("Remove all users"); dao.deleteAll(); }
@Override public void deteteUser(Long id) { LOGGER.debug("Delete user with id: {}", id); dao.delete(id); }
@Override public void updateUser(UserAccount userOne) { LOGGER.debug("Update: {}", userOne); dao.update(userOne); }
@Override public UserAccount get(Long id) { return dao.getById(id); }