示例#1
0
  @Override
  public boolean saveUserSettings(UserSettingsDTO dto) {
    UserSettings us = new UserSettings();
    us.setCurrency(dto.getCurrency());
    us.setSendNewsLetter(dto.isSendNews());
    us.setSenMonthlyUpdates(dto.isSendMonthly());
    us.setUserId(getCurrentUser(this.getThreadLocalRequest().getSession()));

    return SearchHelper.getFacade().saveModel(us);
  }
示例#2
0
  @Override
  public UserSettingsDTO fetchUserSettings() {
    UserSettings setting =
        SearchHelper.getFacade()
            .readModelWithId(
                UserSettings.class,
                getCurrentUser(this.getThreadLocalRequest().getSession()),
                false);

    if (null == setting) {
      return null;
    }

    UserSettingsDTO dto = new UserSettingsDTO();
    dto.setCurrency(setting.getCurrency());
    dto.setSendMonthly(setting.isSenMonthlyUpdates());
    dto.setSendNews(setting.isSendNewsLetter());
    return dto;
  }