public IclubPersonBean getBean() { if (bean == null) { bean = new IclubPersonBean(); } if (!loadBean) { if (IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.id")) != null) { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "get/" + getSessionUserId()); IclubPersonModel model = (IclubPersonModel) (client.accept(MediaType.APPLICATION_JSON).get(IclubPersonModel.class)); client.close(); bean = IclubPersonTrans.fromWStoUI(model); if (IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.login.id")) != null) { client = IclubWebHelper.createCustomClient( LOG_BASE_URL + "get/" + IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.login.id")) .toString()); } else { client = IclubWebHelper.createCustomClient(LOG_BASE_URL + "person/" + bean.getPFName()); } IclubLoginModel loginModel = (IclubLoginModel) (client.accept(MediaType.APPLICATION_JSON).get(IclubLoginModel.class)); if (loginModel != null && loginModel.getLId() != null) { updateLogin = true; loginBean = IclubLoginTrans.fromWStoUI(loginModel); } else { updateLogin = false; loginBean = new IclubLoginBean(); } } } return bean; }
public static IclubPersonModel fromUItoWS(IclubPersonBean bean) { IclubPersonModel model = new IclubPersonModel(); model.setPId(bean.getPId()); model.setPCrtdDt(bean.getPCrtdDt()); model.setPDob(bean.getPDob()); model.setPEmail(bean.getPEmail()); model.setPFName(bean.getPFName()); model.setPIdNum(bean.getPIdNum()); model.setPLName(bean.getPLName()); model.setPAge(bean.getPAge()); model.setPMobile(bean.getPMobile()); model.setPAddress(bean.getPAddress()); model.setPContactPref(bean.getPContactPref()); model.setPGender(bean.getPGender()); model.setPContactPref(bean.getPContactPref()); model.setPIdExpiryDt(bean.getPIdExpiryDt()); model.setPInitials(bean.getPInitials()); model.setPIsPensioner(bean.getPIsPensioner()); model.setPIdIssueCntry( bean.getPIdIssueCntry() != null ? bean.getPIdIssueCntry().longValue() : null); model.setPIdIssueDt(bean.getPIdIssueDt()); model.setPLat(bean.getPLat()); model.setPLong(bean.getPLong()); model.setPOccupation(bean.getPOccupation()); model.setPTitle(bean.getPTitle()); model.setPZipCd(bean.getPZipCd()); model.setIclubIdType(bean.getIclubIdType()); model.setItLongDesc(bean.getItLongDesc()); model.setIclubMaritalStatus(bean.getIclubMaritalStatus()); model.setMsLongDesc(bean.getMsLongDesc()); model.setIclubPerson(bean.getIclubPerson()); model.setPFNameAndLName(bean.getPFNameAndLName()); model.setIclubCohort(bean.getIclubCohort()); model.setCEmail(bean.getCEmail()); model.setIclubCohortInvite(bean.getIclubCohortInvite()); return model; }
public boolean validateForm(boolean flag) { boolean ret = true; if (bean.getPFName() == null || bean.getPFName().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(("First Name Cannot be empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getPLName() == null || bean.getPLName().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(("Last Name Cannot be empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getPMobile() == null || bean.getPMobile().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(("Mobile Number Cannot be empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getPGender() == null || bean.getPGender().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(("Gender Cannot be empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getPIdNum() == null || bean.getPIdNum().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(("Id Number Cannot be empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getIclubIdType() == null) { IclubWebHelper.addMessage(("Please Select ID Type"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getPIsPensioner() == null || bean.getPIsPensioner().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(("Please Select Pensioner"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getPDob() == null) { IclubWebHelper.addMessage(("Please Select DOB"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } else if (IclubWebHelper.calculateYearDiff(bean.getPDob().getTime()) <= 18) { IclubWebHelper.addMessage(("You must be over 18 years"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getPIdIssueDt() == null) { IclubWebHelper.addMessage(("Please Select IssueDate"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } else if (IclubWebHelper.isCurrentDate(bean.getPIdIssueDt().getTime())) { IclubWebHelper.addMessage( ("Issue Date Should be less than Current Date"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } else if (bean.getPIdExpiryDt() != null && !IclubWebHelper.isCurrentDate(bean.getPIdExpiryDt().getTime())) { IclubWebHelper.addMessage( ("Expiry Date Should be greater than Current Date"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } else if (bean.getPIdExpiryDt() != null && !IclubWebHelper.isCurrentDate(bean.getPIdExpiryDt().getTime())) { IclubWebHelper.addMessage( ("Expiry Date Should be greater than Current Date"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } else if (((Long) bean.getPIdIssueDt().getTime()) .compareTo(((Long) bean.getPIdExpiryDt().getTime())) >= 0) { IclubWebHelper.addMessage( (" Id Issue Date Should be less than Expiry Date"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } String idValidate = IclubWebHelper.validateId(bean.getPIdNum(), bean.getPGender()); if (idValidate != null && !idValidate.trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(idValidate, FacesMessage.SEVERITY_ERROR); ret = ret && false; } return ret; }