if(users.size() != 1) {
throw new IllegalStateException("User with [login=" + loginName + "] was not found.");
}
SeteUser su = users.get(0);
AuthenticatedUserVo vo = new AuthenticatedUserVo();
vo.setFirstName(su.getFirstName());
vo.setLastName(su.getLastName());
vo.setLoginName(su.getLoginName());
vo.setMiddleName(su.getMiddleName());
vo.setUserId(su.getId());
List<UserRolePrivilegeVo> pVos = new ArrayList<UserRolePrivilegeVo>();
UserRolePrivilegeVo pVo = null;
List<UserPrivilegeVo> upVos = null;
UserPrivilegeVo upVo = null;
for(UserRolePrivilege p : su.getUserRolePrivileges()) {
pVo = new UserRolePrivilegeVo();
pVo.setRoleType(p.getUserRoleType());
upVos = new ArrayList<UserPrivilegeVo>();
for(UserPrivilege up : p.getUserPrivileges()) {
upVo = new UserPrivilegeVo();
upVo.setPrivilegeType(up.getUserPrivilegeType());
upVo.setActionType(up.getPrivilegeActionType());
upVos.add(upVo);
}
pVo.setUserPrivileges(upVos);
pVos.add(pVo);
}
vo.setUserRolePrivileges(pVos);
return vo;
}