Esempio n. 1
0
 @Override
 public Object visit(PropertyIsNull filter, Object extraData) {
   checkExpressionIsProperty(filter.getExpression());
   StringWriter output = asStringWriter(extraData);
   ExpressionToSolr visitor = new ExpressionToSolr();
   PropertyName propertyName = (PropertyName) filter.getExpression();
   output.append("-");
   propertyName.accept(visitor, output);
   output.append(":[* TO *]");
   return output;
 }
  @Test
  public void testNullFilter() throws Exception {
    PropertyIsNull nullFilter = ff.isNull(ff.property("measurement/result"));

    Filter unrolled = (Filter) nullFilter.accept(visitor, null);
    assertTrue(unrolled instanceof PropertyIsNull);
    assertNotSame(nullFilter, unrolled);

    PropertyIsNull unmapped = (PropertyIsNull) unrolled;
    Expression unmappedAtt = unmapped.getExpression();
    assertTrue(unmappedAtt instanceof PropertyName);
    assertEquals("results_value", ((PropertyName) unmappedAtt).getPropertyName());
  }
  public Object visit(PropertyIsNull filter, Object notUsed) {
    if (original == null) original = filter;

    if (!fcs.supports(PropertyIsNull.class)) {
      postStack.push(filter);

      return null;
    }

    int i = postStack.size();
    ((PropertyIsNull) filter).getExpression().accept(this, null);

    if (i < postStack.size()) {
      postStack.pop();
      postStack.push(filter);
    }

    preStack.pop(); // null
    preStack.push(filter);

    return null;
  }
 public Object visit(PropertyIsNull filter, Object notUsed) {
   return visitNullNil(filter, filter.getExpression());
 }