@Override public UserDto convertTo(User source, UserDto dest) { if (dest == null) { dest = new UserDto(); } dest.setId(source.getId().toString()); dest.setLogin(source.getUsername()); dest.setRoles(toString(source.getRoles())); return dest; }
@Override public User convertFrom(UserDto source, User dest) { if (dest == null) { dest = new User(); } dest.setId(new Long(source.getId())); dest.setLogin(source.getLogin()); dest.getAuthorities().clear(); dest.getAuthorities().addAll(toAuthorities(dest, source.getRoles())); return dest; }