@Test void filterNoEntities() { PolicyFilter filter = new PolicyFilter(); Bundle filteredBundle = new Bundle(); Bundle bundle = FilterTestUtils.getBundle(); bundle.setDependencyMap(Collections.emptyMap()); List<Policy> filteredEntities = filter.filter("/my/folder/path", new FilterConfiguration(), bundle, filteredBundle); assertEquals(0, filteredEntities.size()); }
@Override public List<Policy> filter(String folderPath, FilterConfiguration filterConfiguration, Bundle bundle, Bundle filteredBundle) { Map<String, Folder> folders = filteredBundle.getEntities(Folder.class); return bundle.getEntities(Policy.class).values().stream() .filter(p -> folders.containsKey(p.getParentFolderId())).collect(Collectors.toList()); }
PolicyFilter implements EntityFilter<Policy> { @Override public List<Policy> filter(String folderPath, FilterConfiguration filterConfiguration, Bundle bundle, Bundle filteredBundle) { Map<String, Folder> folders = filteredBundle.getEntities(Folder.class); return bundle.getEntities(Policy.class).values().stream() .filter(p -> folders.containsKey(p.getParentFolderId())).collect(Collectors.toList()); } }
PolicyFilter implements EntityFilter<Policy> { @Override public List<Policy> filter(String folderPath, FilterConfiguration filterConfiguration, Bundle bundle, Bundle filteredBundle) { Map<String, Folder> folders = filteredBundle.getEntities(Folder.class); return bundle.getEntities(Policy.class).values().stream() .filter(p -> folders.containsKey(p.getParentFolderId())).collect(Collectors.toList()); }  }
PolicyFilter implements EntityFilter<Policy> { @Override public List<Policy> filter(String folderPath, FilterConfiguration filterConfiguration, Bundle bundle, Bundle filteredBundle) { Map<String, Folder> folders = filteredBundle.getEntities(Folder.class); return bundle.getEntities(Policy.class).values().stream() .filter(p -> folders.containsKey(p.getParentFolderId())).collect(Collectors.toList()); }  @Override @NotNull Collection<Class<? extends EntityFilter>> getDependencyEntityFilters(); @Override List<Policy> filter(String folderPath, FilterConfiguration filterConfiguration, Bundle bundle, Bundle filteredBundle); }
PolicyFilter implements EntityFilter<Policy> { @Override public List<Policy> filter(String folderPath, FilterConfiguration filterConfiguration, Bundle bundle, Bundle filteredBundle) { Map<String, Folder> folders = filteredBundle.getEntities(Folder.class); return bundle.getEntities(Policy.class).values().stream() .filter(p -> folders.containsKey(p.getParentFolderId())).collect(Collectors.toList()); }  @Override @NotNull Collection<Class<? extends EntityFilter>> getDependencyEntityFilters(); @Override List<Policy> filter(String folderPath, FilterConfiguration filterConfiguration, Bundle bundle, Bundle filteredBundle);  }