コード例 #1
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);
    }
  }
コード例 #2
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();
  }
コード例 #3
0
  public void deleteByUserId(Integer userId) throws SQLException {

    UserIntegerSettingDao.deleteByUserIdAndSettingEnum(null, userId, this);
  }