@Test public void testPartialPredicateExtraction() { FilterExpression dataStoreExpression = new InPredicate(new Path(Book.class, dictionary, "genre"), "Literary Fiction"); FilterExpression inMemoryExpression = new InPredicate(new Path(Book.class, dictionary, "editor.firstName"), "Literary Fiction"); FilterExpression finalExpression = new NotFilterExpression(new OrFilterExpression(dataStoreExpression, inMemoryExpression)); FilterExpression extracted = FilterPredicatePushdownExtractor.extractPushDownPredicate(dictionary, finalExpression); assertEquals(((InPredicate) dataStoreExpression).negate(), extracted); }
public static FilterExpression extractPushDownPredicate(EntityDictionary dictionary, FilterExpression expression) { FilterExpressionNormalizationVisitor normalizationVisitor = new FilterExpressionNormalizationVisitor(); FilterExpression normalizedExpression = expression.accept(normalizationVisitor); FilterPredicatePushdownExtractor verifier = new FilterPredicatePushdownExtractor(dictionary); return normalizedExpression.accept(verifier); }
FilterPredicatePushdownExtractor implements FilterExpressionVisitor<FilterExpression> { public static FilterExpression extractPushDownPredicate(EntityDictionary dictionary, FilterExpression expression) { FilterExpressionNormalizationVisitor normalizationVisitor = new FilterExpressionNormalizationVisitor(); FilterExpression normalizedExpression = expression.accept(normalizationVisitor); FilterPredicatePushdownExtractor verifier = new FilterPredicatePushdownExtractor(dictionary); return normalizedExpression.accept(verifier); } }
FilterPredicatePushdownExtractor implements FilterExpressionVisitor<FilterExpression> { public static FilterExpression extractPushDownPredicate(EntityDictionary dictionary, FilterExpression expression) { FilterExpressionNormalizationVisitor normalizationVisitor = new FilterExpressionNormalizationVisitor(); FilterExpression normalizedExpression = expression.accept(normalizationVisitor); FilterPredicatePushdownExtractor verifier = new FilterPredicatePushdownExtractor(dictionary); return normalizedExpression.accept(verifier); } FilterPredicatePushdownExtractor(EntityDictionary dictionary); }
FilterPredicatePushdownExtractor implements FilterExpressionVisitor<FilterExpression> { public static FilterExpression extractPushDownPredicate(EntityDictionary dictionary, FilterExpression expression) { FilterExpressionNormalizationVisitor normalizationVisitor = new FilterExpressionNormalizationVisitor(); FilterExpression normalizedExpression = expression.accept(normalizationVisitor); FilterPredicatePushdownExtractor verifier = new FilterPredicatePushdownExtractor(dictionary); return normalizedExpression.accept(verifier); } FilterPredicatePushdownExtractor(EntityDictionary dictionary); @Override FilterExpression visitPredicate(FilterPredicate filterPredicate); @Override FilterExpression visitAndExpression(AndFilterExpression expression); @Override FilterExpression visitOrExpression(OrFilterExpression expression); @Override FilterExpression visitNotExpression(NotFilterExpression expression); static FilterExpression extractPushDownPredicate(EntityDictionary dictionary, FilterExpression expression); }
FilterPredicatePushdownExtractor implements FilterExpressionVisitor<FilterExpression> { public static FilterExpression extractPushDownPredicate(EntityDictionary dictionary, FilterExpression expression) { FilterExpressionNormalizationVisitor normalizationVisitor = new FilterExpressionNormalizationVisitor(); FilterExpression normalizedExpression = expression.accept(normalizationVisitor); FilterPredicatePushdownExtractor verifier = new FilterPredicatePushdownExtractor(dictionary); return normalizedExpression.accept(verifier); } FilterPredicatePushdownExtractor(EntityDictionary dictionary); @Override FilterExpression visitPredicate(FilterPredicate filterPredicate); @Override FilterExpression visitAndExpression(AndFilterExpression expression); @Override FilterExpression visitOrExpression(OrFilterExpression expression); @Override FilterExpression visitNotExpression(NotFilterExpression expression); static FilterExpression extractPushDownPredicate(EntityDictionary dictionary, FilterExpression expression);  }