public void delIclubBuildingState() { LOGGER.info("Class :: " + this.getClass() + " :: Method :: delIclubBuildingState"); try { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "del/" + bean.getBsId()); Response response = client.accept(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 200) { IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("del.success"), FacesMessage.SEVERITY_INFO); clearForm(); } else { IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("del.service.error"), FacesMessage.SEVERITY_ERROR); } } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("del.error") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }
public String updatedUser() { try { if (validateForm(!true) && validateLoginForm(!updateLogin)) { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "mod"); IclubPersonModel model = IclubPersonTrans.fromUItoWS(bean); model.setIclubPerson(getSessionUserId()); ResponseModel response = client.accept(MediaType.APPLICATION_JSON).put(model, ResponseModel.class); client.close(); if (response.getStatusCode() == 0) { return updateLogin(); } else { IclubWebHelper.addMessage( "Fail :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); } } else { IclubWebHelper.addMessage("Fail :: ", FacesMessage.SEVERITY_ERROR); } } catch (Exception e) { IclubWebHelper.addMessage("Fail :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } return null; }
public void handleFileUpload(FileUploadEvent fue) { String docId = UUID.randomUUID().toString(); getDocIds().add(docId); try { IclubDocumentModel model = new IclubDocumentModel(); model.setIclubPerson(getSessionUserId()); model.setDCrtdDt(new Date(System.currentTimeMillis())); model.setDId(docId); model.setDName(fue.getFile().getFileName()); model.setDContent(fue.getFile().getContentType()); model.setDSize(fue.getFile().getSize()); WebClient client = IclubWebHelper.createCustomClient(D_BASE_URL + "add"); ResponseModel response = client.accept(MediaType.APPLICATION_JSON).post(model, ResponseModel.class); client.close(); if (response.getStatusCode() == 0) { ContentDisposition cd = new ContentDisposition( "attachment;filename=" + fue.getFile().getFileName() + ";filetype=" + fue.getFile().getContentType()); List<Attachment> attachments = new ArrayList<Attachment>(); Attachment attachment = new Attachment(docId, fue.getFile().getInputstream(), cd); attachments.add(attachment); WebClient uploadClient = WebClient.create(D_BASE_URL + "upload"); Response res = uploadClient.type("multipart/form-data").post(new MultipartBody(attachments)); uploadClient.close(); if (res.getStatus() == 200) { IclubWebHelper.addMessage( getLabelBundle().getString("doucmentuploadedsuccessfully"), FacesMessage.SEVERITY_INFO); } else { IclubWebHelper.addMessage( getLabelBundle().getString("doucmentuploadingfailed") + " :: " + (res.getHeaderString("status") != null ? res.getHeaderString("status") : res.getStatusInfo()), FacesMessage.SEVERITY_ERROR); } } } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("doucmentuploadingerror") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }
public boolean validateLogin() { boolean ret = false; if (bean.getLName() == null || bean.getLName().trim().length() == 0) { IclubWebHelper.addMessage("Login Name Cannot be null", FacesMessage.SEVERITY_ERROR); ret = true; } if (bean.getLPasswd() == null || bean.getLPasswd().trim().length() == 0) { IclubWebHelper.addMessage("Password Cannot be null", FacesMessage.SEVERITY_ERROR); ret = true; } return ret; }
public void deleteDocument(String selDocId) { try { WebClient client = IclubWebHelper.createCustomClient(D_BASE_URL + "del/" + selDocId); client.get(); client.close(); } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("doucmentuploadingerror") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }
public static void setTheme() { String viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId(); if (viewId != null && viewId.contains("spark")) { IclubWebHelper.addObjectIntoSession(BUNDLE.getString("logged.in.user.theme"), "-spark"); IclubWebHelper.addObjectIntoSession(BUNDLE.getString("logged.in.user.webTheme"), "spark"); } else { IclubWebHelper.addObjectIntoSession(BUNDLE.getString("logged.in.user.theme"), ""); IclubWebHelper.addObjectIntoSession(BUNDLE.getString("logged.in.user.webTheme"), "sentinel"); } }
public void updatePassword() { try { if (validateLoginForm(!updateLogin)) { IclubLoginModel model = new IclubLoginModel(); WebClient client = null; if (loginBean.getLId() != null) { client = IclubWebHelper.createCustomClient(BASE_URL + "mod"); model.setLId(loginBean.getLId()); } else { client = IclubWebHelper.createCustomClient(LOG_BASE_URL + "add"); model.setLId(UUID.randomUUID().toString()); } model.setLCrtdDt(new Date(System.currentTimeMillis())); model.setLLastDate(loginBean.getLLastDate()); model.setLName(loginBean.getLName()); model.setLPasswd(Base64.encodeBase64URLSafeString(DigestUtils.md5(loginBean.getLPasswd()))); model.setLSecAns(loginBean.getLSecAns()); model.setIclubPersonAByLCrtdBy(bean.getPId()); model.setIclubPersonBByLPersonId(getSessionUserId()); model.setIclubRoleType(2l); model.setIclubSecurityQuestion(loginBean.getIclubSecurityQuestion()); ResponseModel response = null; if (updateLogin) { response = client.accept(MediaType.APPLICATION_JSON).put(model, ResponseModel.class); } else { response = client.accept(MediaType.APPLICATION_JSON).post(model, ResponseModel.class); } if (response.getStatusCode() == 0) { IclubWebHelper.addMessage( "Personal Details Updated Successfully", FacesMessage.SEVERITY_INFO); } else { IclubWebHelper.addMessage( "Fail :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); } } } catch (Exception e) { IclubWebHelper.addMessage("Fail :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }
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 boolean validateLoginForm(boolean flag) { boolean ret = true; if (loginBean.getLPasswd() == null || loginBean.getLPasswd().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(("Password Cannot be empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (loginBean.getIclubSecurityQuestion() == null) { IclubWebHelper.addMessage(("Please select Security Question"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (loginBean.getLSecAns() == null || loginBean.getLSecAns().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage(("Security Ans Cannot be empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } return ret; }
public void addIclubVehicleMaster() { LOGGER.info("Class :: " + this.getClass() + " :: Method :: addIclubVehicleMaster"); try { if (validateForm(true)) { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "add"); IclubVehicleMasterModel model = IclubVehicleMasterTrans.fromUItoWS(bean); model.setVmCrtdDt(new Date(System.currentTimeMillis())); model.setIclubPerson(getSessionUserId()); ResponseModel response = client.accept(MediaType.APPLICATION_JSON).post(model, ResponseModel.class); client.close(); if (response.getStatusCode() == 0) { IclubWebHelper.addMessage( getLabelBundle().getString("vehiclemaster") + " " + getLabelBundle().getString("add.success"), FacesMessage.SEVERITY_INFO); viewParam = 1l; showView(); } else { IclubWebHelper.addMessage( getLabelBundle().getString("vehiclemaster") + " " + getLabelBundle().getString("add.error") + " :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); } } } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("vehiclemaster") + " " + getLabelBundle().getString("add.error") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }
public void showDocumentUpload() { LOGGER.info("Class :: " + this.getClass() + " :: Method :: showDocumentUpload"); if (getDocIds().size() != 0) { for (String doc : getDocIds()) { WebClient client = IclubWebHelper.createCustomClient(D_BASE_URL + "del/" + doc); client.get(); client.close(); } } getDocIds().clear(); }
public void modIclubBuildingState() { LOGGER.info("Class :: " + this.getClass() + " :: Method :: modIclubBuildingState"); try { if (validateForm(false)) { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "mod"); IclubBuildingStateModel model = IclubBuildingStateTrans.fromUItoWS(bean); ResponseModel response = client.accept(MediaType.APPLICATION_JSON).put(model, ResponseModel.class); client.close(); if (response.getStatusCode() == 0) { IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("mod.success"), FacesMessage.SEVERITY_INFO); clearForm(); } else { IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("mod.error") + " :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); } } } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("mod.error") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }
public String getState(String from) { String state = "{from:" + from + "}"; try { if (IclubWebHelper.getObjectIntoSession("newInvite") != null) { state = "{from:" + from + ",redirect:newInvite}"; } state = Base64.encodeBase64URLSafeString(state.getBytes()); } catch (Exception e) { e.printStackTrace(); } return state; }
public boolean validateForm(boolean flag) { boolean ret = true; if (bean.getBsShortDesc() != null && !bean.getBsShortDesc().trim().equalsIgnoreCase("")) { WebClient client = IclubWebHelper.createCustomClient( BASE_URL + "validate/sd/" + bean.getBsShortDesc().trim() + "/" + ((bean.getBsId() == null) ? -999l : bean.getBsId())); ResponseModel message = client.accept(MediaType.APPLICATION_JSON).get(ResponseModel.class); client.close(); if (message.getStatusCode() != 0) { IclubWebHelper.addMessage(message.getStatusDesc(), FacesMessage.SEVERITY_ERROR); ret = ret && false; } } else { IclubWebHelper.addMessage( getLabelBundle().getString("val.shortdesc.empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getBsLongDesc() == null || bean.getBsLongDesc().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage( getLabelBundle().getString("val.longdesc.empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getBsStatus() == null || bean.getBsStatus().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage( getLabelBundle().getString("val.select.valid"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } return ret; }
public List<IclubIdTypeBean> getIdTypeBeans() { WebClient client = IclubWebHelper.createCustomClient(IT_BASE_URL + "list"); Collection<? extends IclubIdTypeModel> models = new ArrayList<IclubIdTypeModel>( client.accept(MediaType.APPLICATION_JSON).getCollection(IclubIdTypeModel.class)); client.close(); idTypeBeans = new ArrayList<IclubIdTypeBean>(); if (models != null && models.size() > 0) { for (IclubIdTypeModel model : models) { IclubIdTypeBean bean = IclubIdTypeTrans.fromWStoUI(model); idTypeBeans.add(bean); } } return idTypeBeans; }
public List<IclubVehicleMasterBean> getDashBoardBeans() { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "/get/user/" + getSessionUserId()); Collection<? extends IclubVehicleMasterModel> models = new ArrayList<IclubVehicleMasterModel>( client.accept(MediaType.APPLICATION_JSON).getCollection(IclubVehicleMasterModel.class)); client.close(); dashBoardBeans = new ArrayList<IclubVehicleMasterBean>(); if (models != null && models.size() > 0) { for (IclubVehicleMasterModel model : models) { IclubVehicleMasterBean bean = IclubVehicleMasterTrans.fromWStoUI(model); dashBoardBeans.add(bean); } } return dashBoardBeans; }
@SuppressWarnings("unchecked") public void downloadDocument(String selDocId) { try { WebClient client = WebClient.create(D_BASE_URL + "download/" + selDocId); client.type("multipart/form-data").accept(MediaType.MULTIPART_FORM_DATA); List<Attachment> attachments = (List<Attachment>) client.getCollection(Attachment.class); file = new DefaultStreamedContent( attachments.get(0).getDataHandler().getInputStream(), attachments.get(0).getContentDisposition().getParameter("filetype"), attachments.get(0).getContentDisposition().getParameter("filename")); client.close(); } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("doucmentuploadingerror") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }
public void doIclubLogout() { String theme = ""; String webTheme = ""; if (IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.theme")) != null) { theme = IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.theme")).toString(); } if (IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.webTheme")) != null) { webTheme = IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.webTheme")) .toString(); } IclubWebHelper.invalidateSession(); IclubWebHelper.addObjectIntoSession(BUNDLE.getString("logged.in.user.theme"), theme); IclubWebHelper.addObjectIntoSession(BUNDLE.getString("logged.in.user.webTheme"), webTheme); FacesContext context = FacesContext.getCurrentInstance(); NavigationHandler navigationHandler = context.getApplication().getNavigationHandler(); navigationHandler.handleNavigation( context, null, "/templates/login" + theme + ".xhtml?faces-redirect=true"); String url = "https://testclientapi.fraudcheck.co.za/api/authenticate/test"; String currentDate = System.currentTimeMillis() + ""; String fcHash = DigestUtils.md5Hex(FRAUD_CHECK_USERID + FRAUD_CHECK_PWD + currentDate); HttpClient client = getHttpClient(); try { HttpPost post = new HttpPost(url); post.setHeader("Content-Type", "application/json"); post.setHeader("FcAccId", FRAUD_CHECK_USERID); post.setHeader("FcHash", fcHash); post.setHeader("FcDate", currentDate); List<NameValuePair> arguments = new ArrayList<>(3); arguments.add(new BasicNameValuePair("data", "test")); post.setEntity(new UrlEncodedFormEntity(arguments)); HttpResponse response1 = client.execute(post); EntityUtils.toString(response1.getEntity()); } catch (Exception e) { LOGGER.error(e, e); } }
public List<IclubDocumentBean> getDocs() { if (bean != null && bean.getPId() != null) { WebClient client = IclubWebHelper.createCustomClient(D_BASE_URL + "get/entity/" + bean.getPId() + "" + "/1"); Collection<? extends IclubDocumentModel> models = new ArrayList<IclubDocumentModel>( client.accept(MediaType.APPLICATION_JSON).getCollection(IclubDocumentModel.class)); client.close(); docs = new ArrayList<IclubDocumentBean>(); if (models != null && models.size() > 0) { for (IclubDocumentModel model : models) { IclubDocumentBean bean = IclubDocumentTrans.fromWStoUI(model); docs.add(bean); } } } else { docs = new ArrayList<IclubDocumentBean>(); } return docs; }
public String updateLogin() { try { if (validateLoginForm(!updateLogin)) { IclubLoginModel model = new IclubLoginModel(); WebClient client = null; if (loginBean.getLId() != null) { client = IclubWebHelper.createCustomClient(LOG_BASE_URL + "mod"); model.setLId(loginBean.getLId()); } else { client = IclubWebHelper.createCustomClient(LOG_BASE_URL + "add"); model.setLId(UUID.randomUUID().toString()); } model.setLCrtdDt(new Date(System.currentTimeMillis())); model = IclubLoginTrans.fromUItoWS(loginBean); model.setLPasswd(Base64.encodeBase64URLSafeString(DigestUtils.md5(loginBean.getLPasswd()))); model.setIclubPersonAByLCrtdBy(bean.getPId()); model.setIclubPersonBByLPersonId(getSessionUserId()); model.setIclubRoleType(2l); ResponseModel response = null; if (updateLogin) { response = client.accept(MediaType.APPLICATION_JSON).put(model, ResponseModel.class); } else { response = client.accept(MediaType.APPLICATION_JSON).post(model, ResponseModel.class); } if (response.getStatusCode() == 0) { IclubWebHelper.addObjectIntoSession("social_update_profile", null); IclubWebHelper.addMessage( "Personal Details Updated Successfully", FacesMessage.SEVERITY_INFO); loadBean = false; return "userDashboard"; } else { IclubWebHelper.addMessage( "Fail :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); } } } catch (Exception e) { IclubWebHelper.addMessage("Fail :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } return null; }
public String updatedPerson() { try { if (validateForm(!true)) { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "mod"); IclubPersonModel model = IclubPersonTrans.fromUItoWS(bean); model.setIclubPerson(getSessionUserId()); ResponseModel response = client.accept(MediaType.APPLICATION_JSON).put(model, ResponseModel.class); client.close(); if (response.getStatusCode() == 0) { for (String doc : getDocIds()) { IclubDocumentModel docModel = new IclubDocumentModel(); docModel.setDId(doc); docModel.setDEntityId(model.getPId().toString()); docModel.setIclubEntityType(1l); WebClient docClient = IclubWebHelper.createCustomClient(D_BASE_URL + "mod"); ResponseModel res = docClient.accept(MediaType.APPLICATION_JSON).put(docModel, ResponseModel.class); if (res.getStatusCode() == 0) LOGGER.info("Doc Merge Successful :: " + doc); } docIds = null; IclubWebHelper.addMessage("Updated Successfully", FacesMessage.SEVERITY_INFO); return "userDashboard"; } else { IclubWebHelper.addMessage( "Fail :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); } } else { IclubWebHelper.addMessage("Fail :: ", FacesMessage.SEVERITY_ERROR); } } catch (Exception e) { IclubWebHelper.addMessage("Fail :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } return ""; }
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 String getSessionUserId() { Object sessUsrId = IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.id")); if (sessUsrId == null) sessionUserId = "1"; else sessionUserId = sessUsrId.toString(); return sessionUserId; }
public String getUserName() { userName = IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.scname")).toString(); return userName; }
public void newCohortInviteAction() { setTheme(); IclubWebHelper.addObjectIntoSession("newInvite", "true"); }
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 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; }