public void validateID(AjaxBehaviorEvent event) { String idValidate = IclubWebHelper.validateId(bean.getPIdNum(), bean.getPGender()); if (idValidate != null && !idValidate.trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(idValidate, FacesMessage.SEVERITY_ERROR); } else { String dateOfBirth = bean.getPIdNum().toString().substring(0, 6); SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd"); try { Date dateOfBirthD = formatter.parse(dateOfBirth); bean.setPDob(dateOfBirthD); } catch (ParseException e) { e.printStackTrace(); } } }
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; }