Beispiel #1
0
  private UserVO userPojoToVo(NdgUser user) {
    UserVO vo = new UserVO();
    RoleVO roleVO = new RoleVO();
    roleVO.setName(user.getRole().getRoleName());
    vo.setRole(roleVO);

    CompanyVO companyVO = new CompanyVO();
    companyVO.setCompanyName(user.getCompany().getCompanyName());
    companyVO.setCompanyType(user.getCompany().getCompanyType());
    companyVO.setCompanyCountry(user.getCompany().getCompanyCountry());
    companyVO.setCompanyIndustry(user.getCompany().getCompanyIndustry());
    companyVO.setCompanySize(user.getCompany().getCompanySize());
    vo.setCompany(companyVO);

    vo.setUsername(user.getUsername());
    vo.setPassword(user.getPassword());
    vo.setFirstName(user.getFirstName());
    vo.setLastName(user.getLastName());
    vo.setEmail(user.getEmail());
    vo.setUserAdmin(user.getUserAdmin());

    vo.setCountryCode(user.getCountryCode());
    vo.setAreaCode(user.getAreaCode());
    vo.setPhoneNumber(user.getPhoneNumber());
    vo.setRetCode(UserVO.AUTHENTICATED);
    vo.setUserValidated(user.getUserValidated());
    vo.setValidationKey(user.getValidationKey());

    vo.setHasFullPermissions(user.getHasFullPermissions());
    return vo;
  }
Beispiel #2
0
 @SuppressWarnings("finally")
 @Override
 public UserVO validateLoginByEmail(String email) throws MSMApplicationException {
   Query query = manager.createNamedQuery("user.findByEmail");
   query.setParameter("email", email);
   NdgUser user = null;
   UserVO vo = new UserVO();
   try {
     user = (NdgUser) query.getSingleResult();
     vo = userPojoToVo(user);
     //			vo.setValidationKey(generateValidationKey(email));
     //			user.setValidationKey(vo.getValidationKey());
     //			manager.merge(user);
     vo.setValidationKey(user.getValidationKey());
   } catch (NoResultException e) {
     vo.setRetCode(UserVO.INVALID_USERNAME);
   } finally {
     return vo;
   }
 }