public RandomAccessFilter buildFilter(BrowseSelection sel) throws IOException {
String[] selections = sel.getValues();
String[] notSelections = sel.getNotValues();
Properties prop = sel.getSelectionProperties();
RandomAccessFilter filter = null;
if (selections != null && selections.length > 0) {
if (sel.getSelectionOperation() == ValueOperation.ValueOperationAnd) {
filter = buildRandomAccessAndFilter(selections, prop);
if (filter == null) {
filter = EmptyFilter.getInstance();
}
} else {
filter = buildRandomAccessOrFilter(selections, prop, false);
if (filter == null) {
return EmptyFilter.getInstance();
}
}
}
if (notSelections != null && notSelections.length > 0) {
RandomAccessFilter notFilter = buildRandomAccessOrFilter(notSelections, prop, true);
if (filter == null) {
filter = notFilter;
} else {
RandomAccessFilter andFilter = new RandomAccessAndFilter(
Arrays.asList(new RandomAccessFilter[] { filter, notFilter }));
filter = andFilter;
}
}