Ejemplo n.º 1
0
  public Integer getValueByUserId(Integer userId) throws SQLException {

    UserIntegerSetting setting =
        UserIntegerSettingDao.getByUserIdAndSettingEnum(null, userId, this);

    // If the setting is not set for the network, return the code's default
    if (setting == null) return this.getIfNull();

    return setting.getValue();
  }
Ejemplo n.º 2
0
  public void setValueByUserId(Integer userId, Integer value) throws SQLException {

    // Attempt to get value
    UserIntegerSetting setting =
        UserIntegerSettingDao.getByUserIdAndSettingEnum(null, userId, this);

    // Does the value already exist?
    if (setting != null) {

      // Yes, update the value
      UserIntegerSettingDao.updateByUserIdAndSettingEnum(null, userId, this, value);

    } else {

      // No, insert the value
      UserIntegerSettingDao.insert(null, userId, this, value);
    }
  }