コード例 #1
0
  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;
  }
コード例 #2
0
  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;
  }