ThemisRead extends ThemisRequest { public ThemisRead setFilter(Filter filter) throws IOException { ThemisCpUtil.processFilters(filter, new FilterCallable() { public void processConcreteFilter(Filter filter) throws IOException { Class<? extends Filter> filterCls = filter.getClass(); if (ThemisCpUtil.DISALLOWD_FILTERS.contains(filterCls)) { throw new IOException("themis read disallow this filter, filter=" + filter.getClass().getName() + ", all disallowed filters : " + ThemisCpUtil.getDisallowedFilterClassNameString()); } } }); return setFilterWithoutCheck(filter); }  abstract Map<byte [], NavigableSet<byte []>> getFamilyMap(); abstract ThemisRead addColumn(byte [] family, byte [] qualifier); abstract ThemisRead addFamily(byte[] family); abstract void setCacheBlocks(boolean cacheBlocks); abstract boolean getCacheBlocks(); ThemisRead setFilter(Filter filter); abstract Filter getFilter(); static void checkContainingPreservedColumns(Map<byte[], NavigableSet<byte[]>> familyMap);  }
@Test public void testSetFilter() throws IOException { ThemisRead[] readers = new ThemisRead[] { new ThemisGet(ROW), new ThemisScan() }; for (ThemisRead reader : readers) { reader.setFilter(null); Assert.assertNull(reader.getFilter()); try { reader.setFilter(new DependentColumnFilter()); Assert.fail(); } catch (IOException e) {} FilterList filterList = new FilterList(); filterList.addFilter(new PrefixFilter()); filterList.addFilter(new ColumnRangeFilter()); try { reader.setFilter(new DependentColumnFilter()); Assert.fail(); } catch (IOException e) {} reader.setFilter(new PrefixFilter()); Assert.assertEquals(PrefixFilter.class.getName(), reader.getFilter().getClass().getName()); filterList = new FilterList(); filterList.addFilter(new PrefixFilter()); reader.setFilter(filterList); Assert.assertEquals(FilterList.class.getName(), reader.getFilter().getClass().getName()); } }