コード例 #1
0
 public void createDefaultParameters(UserID userID) {
   userDAO.saveParameter(
       userID,
       UserSetting.DEFAULT_PROVIDER,
       userSettingTranslator.translateSetting(
           UserSetting.DEFAULT_PROVIDER, DefaultFixDefinitionProvider.DESCRIPTOR));
   userDAO.saveParameter(
       userID,
       UserSetting.STORE_MESSAGES,
       userSettingTranslator.translateSetting(UserSetting.STORE_MESSAGES, Boolean.TRUE));
 }
コード例 #2
0
 public void setParameter(UserID userID, UserSetting userSetting, Object value) {
   String settingValue = userSettingTranslator.translateSetting(userSetting, value);
   Map<UserSetting, Object> userSettings = defaultSettings.get(userID);
   if (userSettings == null) {
     userSettings = new HashMap<>();
   }
   userSettings.put(userSetting, value);
   defaultSettings.put(userID, userSettings);
   userDAO.saveParameter(userID, userSetting, settingValue);
 }
コード例 #3
0
 public void loadParameters(UserID userID) {
   List<UserSettingHolder> userSettingHolders = userDAO.findParameters(userID);
   Map<UserSetting, Object> userSettingsActual = defaultSettings.get(userID);
   if (userSettingsActual == null) {
     userSettingsActual = new HashMap<>();
   }
   for (UserSettingHolder holder : userSettingHolders) {
     userSettingsActual.put(
         holder.getUserSetting(),
         userSettingTranslator.resolveSetting(holder.getUserSetting(), holder.getSettingValue()));
   }
   defaultSettings.put(userID, userSettingsActual);
 }