public String doIclubLogin() { LOGGER.info("Class :: " + this.getClass() + " :: Method :: doIclubLogin"); if (!validateLogin()) { try { WebClient client = IclubWebHelper.createCustomClient( BASE_URL + "person/login/" + bean.getLName() + "/" + Base64.encodeBase64URLSafeString(DigestUtils.md5(bean.getLPasswd()))); ResponseModel response = client.accept(MediaType.APPLICATION_JSON).get(ResponseModel.class); client.close(); if (response.getStatusCode() == 0) { setTheme(); IclubWebHelper.addMessage("Person Logged-In successfully", FacesMessage.SEVERITY_INFO); WebClient loginClient = IclubWebHelper.createCustomClient(BASE_URL + "person/" + bean.getLName()); IclubLoginModel model = loginClient.accept(MediaType.APPLICATION_JSON).get(IclubLoginModel.class); loginClient.close(); if (model != null && model.getLId() != null) { IclubWebHelper.addObjectIntoSession( BUNDLE.getString("logged.in.user.id"), model.getIclubPersonBByLPersonId()); IclubWebHelper.addObjectIntoSession( BUNDLE.getString("logged.in.user.scname"), bean.getLName()); WebClient personClient = IclubWebHelper.createCustomClient( U_BASE_URL + "get/" + model.getIclubPersonBByLPersonId()); IclubPersonModel personModel = personClient.accept(MediaType.APPLICATION_JSON).get(IclubPersonModel.class); personClient.close(); IclubWebHelper.addObjectIntoSession( BUNDLE.getString("logged.in.user.name"), personModel.getPFName() + (personModel.getPLName() == null ? "" : personModel.getPLName() + " ")); IclubWebHelper.addObjectIntoSession( BUNDLE.getString("logged.in.role.id"), model.getIclubRoleType()); return "/pages/dashboard/user/main.xhtml?faces-redirect=true"; } else { IclubWebHelper.addMessage( "Person Profile Fetch Error - Contact Admin", FacesMessage.SEVERITY_ERROR); return ""; } } else { IclubWebHelper.addMessage( "Login error :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); return ""; } } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage("Login error :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); return ""; } } else { return ""; } }
public static IclubPerson fromWStoORM( IclubPersonModel model, IclubIdTypeDAO iclubIdTypeDAO, IclubPersonDAO iclubPersonDAO, IclubMaritalStatusDAO IclubMaritalStatusDAO, IclubCohortDAO iclubCohortDAO, IclubCohortInviteDAO iclubCohortInviteDAO) { IclubPerson bean = new IclubPerson(); bean.setPId(model.getPId()); bean.setPCrtdDt(model.getPCrtdDt()); bean.setPDob(model.getPDob()); bean.setPEmail(model.getPEmail()); bean.setPFName(model.getPFName()); bean.setPIdNum(model.getPIdNum()); bean.setPLName(model.getPLName()); bean.setPMobile(model.getPMobile()); bean.setPAddress(model.getPAddress()); bean.setPContactPref(model.getPContactPref()); bean.setPGender(model.getPGender()); bean.setPIdNum(model.getPIdNum()); bean.setPContactPref(model.getPContactPref()); bean.setPIdExpiryDt(model.getPIdExpiryDt()); bean.setPIdIssueDt(model.getPIdIssueDt()); bean.setPInitials(model.getPInitials()); bean.setPIsPensioner(model.getPIsPensioner()); bean.setPIdIssueCntry(model.getPIdIssueCntry()); bean.setPLat(model.getPLat()); bean.setPLong(model.getPLong()); bean.setPOccupation(model.getPOccupation()); bean.setPTitle(model.getPTitle()); bean.setPAge(model.getPAge()); bean.setPZipCd(model.getPZipCd()); bean.setIclubIdType( model.getIclubIdType() != null ? iclubIdTypeDAO.findById(model.getIclubIdType()) : null); bean.setIclubCohort( model.getIclubCohort() != null ? iclubCohortDAO.findById(model.getIclubCohort()) : null); bean.setIclubPerson( model.getIclubPerson() != null && !model.getIclubPerson().trim().equalsIgnoreCase("") ? iclubPersonDAO.findById(model.getIclubPerson()) : null); bean.setIclubMaritalStatus( model.getIclubMaritalStatus() != null ? IclubMaritalStatusDAO.findById(model.getIclubMaritalStatus()) : null); bean.setIclubPerson( model.getIclubPerson() != null ? iclubPersonDAO.findById(model.getIclubPerson()) : null); bean.setIclubCohortInvite( model.getIclubCohortInvite() != null ? iclubCohortInviteDAO.findById(model.getIclubCohortInvite()) : null); return bean; }
public static IclubPersonBean fromWStoUI(IclubPersonModel model) { IclubPersonBean bean = new IclubPersonBean(); bean.setPId(model.getPId()); bean.setPCrtdDt(model.getPCrtdDt()); bean.setPDob(model.getPDob()); bean.setPEmail(model.getPEmail()); bean.setPFName(model.getPFName()); bean.setPIdNum(model.getPIdNum()); bean.setPLName(model.getPLName()); bean.setPAge(model.getPAge()); bean.setPMobile(model.getPMobile()); bean.setPAddress(model.getPAddress()); bean.setPContactPref(model.getPContactPref()); bean.setPGender(model.getPGender()); bean.setPContactPref(model.getPContactPref()); bean.setPIdExpiryDt(model.getPIdExpiryDt()); bean.setPInitials(model.getPInitials()); bean.setPIsPensioner(model.getPIsPensioner()); bean.setPIdIssueCntry( model.getPIdIssueCntry() != null ? model.getPIdIssueCntry().longValue() : null); bean.setPIdIssueDt(model.getPIdIssueDt()); bean.setPLat(model.getPLat()); bean.setPLong(model.getPLong()); bean.setPOccupation(model.getPOccupation()); bean.setPTitle(model.getPTitle()); bean.setPZipCd(model.getPZipCd()); bean.setIclubIdType(model.getIclubIdType()); bean.setItLongDesc(model.getItLongDesc()); bean.setIclubMaritalStatus(model.getIclubMaritalStatus()); bean.setMsLongDesc(model.getMsLongDesc()); bean.setIclubPerson(model.getIclubPerson()); bean.setPFNameAndLName(model.getPFNameAndLName()); bean.setIclubCohort(model.getIclubCohort()); bean.setCEmail(model.getCEmail()); bean.setIclubCohortInvite(model.getIclubCohortInvite()); return bean; }