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); } }
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(); }
public void deleteByUserId(Integer userId) throws SQLException { UserIntegerSettingDao.deleteByUserIdAndSettingEnum(null, userId, this); }