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 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 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 static IclubPersonModel fromORMtoWS(IclubPerson 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()); 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() != null ? (bean.getIclubIdType().getItId()) : null); model.setItLongDesc( bean.getIclubIdType() != null ? (bean.getIclubIdType().getItLongDesc()) : null); model.setIclubPerson(bean.getIclubPerson() != null ? bean.getIclubPerson().getPId() : null); model.setIclubCohort(bean.getIclubCohort() != null ? bean.getIclubCohort().getCId() : null); model.setCEmail(bean.getIclubCohort() != null ? bean.getIclubCohort().getCEmail() : null); model.setIclubMaritalStatus( bean.getIclubMaritalStatus() != null ? (bean.getIclubMaritalStatus().getMsId()) : null); model.setMsLongDesc( bean.getIclubMaritalStatus() != null ? (bean.getIclubMaritalStatus().getMsLongDesc()) : null); model.setPFNameAndLName( bean.getIclubPerson() != null ? bean.getIclubPerson().getPFName() + " " + bean.getIclubPerson().getPLName() != null ? bean.getIclubPerson().getPLName() : "" : ""); model.setIclubCohortInvite( bean.getIclubCohortInvite() != null ? bean.getIclubCohortInvite().getCiId() : null); return model; }
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; }