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 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 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; }