コード例 #1
0
 @Override
 @PostConstruct
 public void init() {
   try {
     try {
       repository.findAll().iterator().next().getCruncherSettings(CruncherImpl.CRUNCHER_NAME);
     } catch (NoSuchElementException e) {
       repository.save(new Settings());
       repository.findAll().iterator().next().getCruncherSettings(CruncherImpl.CRUNCHER_NAME);
     }
   } catch (CruncherSettingsNotFound cruncherSettingsNotFound) {
     System.out.println("===================================================================");
     System.out.println("Case sensitive: " + caseSensitive);
     System.out.println("Ignore list: " + ignoreList);
     System.out.println("Merge List: " + mergeList);
     System.out.println("===================================================================");
     cruncherImpl = new CruncherImpl(ignoreList, mergeList);
     cruncherImpl.setCaseSensitive(caseSensitive);
     /*CruncherSettings cSettings = new CruncherSettings(CruncherImpl.CRUNCHER_NAME);
     cSettings.addSetting(new Setting<>(CASE_SENSITIVE, cruncherImpl.isCaseSensitive()));
     cSettings.addSetting(new Setting<>(IGNORE_LIST, cruncherImpl.getIgnoreList()));
     cSettings.addSetting(new Setting<>(MERGE_LIST, cruncherImpl.getMergeList()));
     Settings globalSettings = repository.findAll().iterator().next();
     globalSettings.addCruncherSettings(CruncherImpl.CRUNCHER_NAME, cSettings);
     repository.save(globalSettings);*/
     save();
   }
 }
コード例 #2
0
 public void save() {
   CruncherSettings cSettings = null;
   try {
     cSettings =
         repository.findAll().iterator().next().getCruncherSettings(CruncherImpl.CRUNCHER_NAME);
   } catch (CruncherSettingsNotFound cruncherSettingsNotFound) {
     cSettings = new CruncherSettings(CruncherImpl.CRUNCHER_NAME);
   }
   cSettings.addSetting(new Setting<>(CASE_SENSITIVE, cruncherImpl.isCaseSensitive()));
   cSettings.addSetting(new Setting<>(IGNORE_LIST, cruncherImpl.getIgnoreList()));
   cSettings.addSetting(new Setting<>(MERGE_LIST, cruncherImpl.getMergeList()));
   Settings globalSettings = repository.findAll().iterator().next();
   globalSettings.addCruncherSettings(CruncherImpl.CRUNCHER_NAME, cSettings);
   repository.save(globalSettings);
 }