@Test public void testDefaultFilters() { Consumer<List<SavedFilter>> callback = filters -> { assertEquals(3, filters.size()); assertEquals(Constants.INSTANCE.Active(), filters.get(0).getName()); assertEquals(DATA_SET_TASK_LIST_PREFIX + "_" + DEFAULT_FILTER_SETTINGS_KEY, filters.get(0).getKey()); assertEquals(Constants.INSTANCE.Personal(), filters.get(1).getName()); assertEquals(Constants.INSTANCE.Group(), filters.get(2).getName()); }; final MultiGridPreferencesStore store = new MultiGridPreferencesStore(); manager.loadSavedFiltersFromPreferences(store, callback); verify(preferencesService).saveUserPreferences(store); }
@Override public void loadSavedFiltersFromPreferences(final MultiGridPreferencesStore store, final Consumer<List<SavedFilter>> savedFiltersConsumer) { final ArrayList<String> existingGrids = new ArrayList<>(store.getGridsId()); if (existingGrids.contains(TAB_ADMIN)) { removeSavedFilterFromPreferences(TAB_ADMIN, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else if (existingGrids.contains(TAB_ALL)) { removeSavedFilterFromPreferences(TAB_ALL, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else { super.loadSavedFiltersFromPreferences(store, savedFiltersConsumer); } }
TaskListFilterSettingsManager extends AbstractTaskListFilterSettingsManager { @Override public void loadSavedFiltersFromPreferences(final MultiGridPreferencesStore store, final Consumer<List<SavedFilter>> savedFiltersConsumer) { final ArrayList<String> existingGrids = new ArrayList<>(store.getGridsId()); if (existingGrids.contains(TAB_ADMIN)) { removeSavedFilterFromPreferences(TAB_ADMIN, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else if (existingGrids.contains(TAB_ALL)) { removeSavedFilterFromPreferences(TAB_ALL, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else { super.loadSavedFiltersFromPreferences(store, savedFiltersConsumer); } } }
TaskListFilterSettingsManager extends AbstractTaskListFilterSettingsManager { @Override public void loadSavedFiltersFromPreferences(final MultiGridPreferencesStore store, final Consumer<List<SavedFilter>> savedFiltersConsumer) { final ArrayList<String> existingGrids = new ArrayList<>(store.getGridsId()); if (existingGrids.contains(TAB_ADMIN)) { removeSavedFilterFromPreferences(TAB_ADMIN, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else if (existingGrids.contains(TAB_ALL)) { removeSavedFilterFromPreferences(TAB_ALL, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else { super.loadSavedFiltersFromPreferences(store, savedFiltersConsumer); } }  }
TaskListFilterSettingsManager extends AbstractTaskListFilterSettingsManager { @Override public void loadSavedFiltersFromPreferences(final MultiGridPreferencesStore store, final Consumer<List<SavedFilter>> savedFiltersConsumer) { final ArrayList<String> existingGrids = new ArrayList<>(store.getGridsId()); if (existingGrids.contains(TAB_ADMIN)) { removeSavedFilterFromPreferences(TAB_ADMIN, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else if (existingGrids.contains(TAB_ALL)) { removeSavedFilterFromPreferences(TAB_ALL, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else { super.loadSavedFiltersFromPreferences(store, savedFiltersConsumer); } }  @Inject void setIdentity(final User identity); @Override String getGridGlobalPreferencesKey(); @Override void loadSavedFiltersFromPreferences(final MultiGridPreferencesStore store,
                                                final Consumer<List<SavedFilter>> savedFiltersConsumer); @Override FilterSettings createFilterSettingsPrototype(); @Override List<FilterSettings> initDefaultFilters(); }
TaskListFilterSettingsManager extends AbstractTaskListFilterSettingsManager { @Override public void loadSavedFiltersFromPreferences(final MultiGridPreferencesStore store, final Consumer<List<SavedFilter>> savedFiltersConsumer) { final ArrayList<String> existingGrids = new ArrayList<>(store.getGridsId()); if (existingGrids.contains(TAB_ADMIN)) { removeSavedFilterFromPreferences(TAB_ADMIN, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else if (existingGrids.contains(TAB_ALL)) { removeSavedFilterFromPreferences(TAB_ALL, store, () -> loadSavedFiltersFromPreferences(store, savedFiltersConsumer)); } else { super.loadSavedFiltersFromPreferences(store, savedFiltersConsumer); } }  @Inject void setIdentity(final User identity); @Override String getGridGlobalPreferencesKey(); @Override void loadSavedFiltersFromPreferences(final MultiGridPreferencesStore store,
                                                final Consumer<List<SavedFilter>> savedFiltersConsumer); @Override FilterSettings createFilterSettingsPrototype(); @Override List<FilterSettings> initDefaultFilters();  }