コード例 #1
0
 @Transactional
 @Override
 public UserDto findByNick(String nick) {
   User user = userDao.findByNick(nick);
   UserRole userRole = userRoleDao.findByUser(user);
   UserDto userDto = userConverter.userEntityToDto(user);
   userDto.setRole(userRole.getRole());
   return userDto;
 }
コード例 #2
0
 @Transactional
 @Override
 public UserDto update(UserDto userDto) {
   if (userDto == null) {
     throw new NullPointerException();
   }
   User user = userConverter.userDtoToEntity(userDto);
   UserRole userRole = userRoleDao.findByUser(user);
   userRole.setRole(userDto.getRole());
   userRoleDao.update(userRole);
   return userConverter.userEntityToDto(userDao.update(user));
 }
コード例 #3
0
 @Transactional
 @Override
 public List<UserDto> findAll() {
   List<User> userList = userDao.findAll();
   List<UserDto> resultList = new ArrayList();
   for (User user : userList) {
     UserDto userDto = userConverter.userEntityToDto(user);
     UserRole userRole = userRoleDao.findByUser(user);
     userDto.setRole(userRole.getRole());
     resultList.add(userDto);
   }
   return resultList;
 }
コード例 #4
0
 @Transactional
 @Override
 public long save(UserDto userDto) {
   if (userDto == null) {
     throw new NullPointerException();
   }
   UserRole userRole = new UserRole();
   User user = userConverter.userDtoToEntity(userDto);
   userRole.setUser(user);
   userRole.setRole(userDto.getRole());
   Long id = userDao.save(user);
   userRoleDao.save(userRole);
   return id;
 }