throws UsernameNotFoundException, DataAccessException {
User user = userDao.findByLoginName(userName);
if(user == null) throw new UsernameNotFoundException(userName + " is not existed.");
LoxiaUserDetails result = new LoxiaUserDetails();
User u = new User();
OperatingUnit ou = new OperatingUnit();
OperatingUnitType ouType = new OperatingUnitType();
try {
PropertyUtils.copyProperties(user.getOu().getType(), ouType);
ou.setId(user.getOu().getId());
ou.setCode(user.getOu().getCode());
ou.setName(user.getOu().getName());
ou.setIsAvailable(user.getOu().getIsAvailable());
u.setId(user.getId());
u.setLoginName(user.getLoginName());
u.setUserName(user.getUserName());
u.setPassword(user.getPassword());
u.setIsAccNonExpired(user.getIsAccNonExpired());
u.setIsAccNonLocked(user.getIsAccNonLocked());
u.setIsPwdNonExpired(user.getIsPwdNonExpired());
u.setIsAvailable(user.getIsAvailable());
u.setIsSystem(user.getIsSystem());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Copy bean values error.");
}
ou.setType(ouType);
u.setOu(ou);
result.setUser(u);
List<LoxiaGrantedAuthority> authorities = new ArrayList<LoxiaGrantedAuthority>();
Map<String,Set<Long>> map = new HashMap<String, Set<Long>>();