org.opengis.filter.PropertyIsNull Java Examples

The following examples show how to use org.opengis.filter.PropertyIsNull. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilterToElastic.java    From elasticgeo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Write the FilterBuilder for a Not filter
 * 
 * @param filter the filter to visit
 * @param extraData extra data (unused by this method)
 * 
 */
public Object visit(Not filter, Object extraData) {
    if(filter.getFilter() instanceof PropertyIsNull) {
        Expression expr = ((PropertyIsNull) filter.getFilter()).getExpression();
        expr.accept(this, extraData);
    } else {
        filter.getFilter().accept(this, extraData);
    }

    if(filter.getFilter() instanceof PropertyIsNull) {
        queryBuilder = ImmutableMap.of("exists", ImmutableMap.of("field", field));
    } else {
        queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must_not", queryBuilder));
    }
    return extraData;
}
 
Example #2
Source File: ElasticCapabilities.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
public ElasticCapabilities() {
    super(new ElasticFilterCapabilities());

    addAll(LOGICAL_OPENGIS);
    addAll(SIMPLE_COMPARISONS_OPENGIS);
    addType(PropertyIsNull.class);
    addType(PropertyIsBetween.class);
    addType(Id.class);
    addType(IncludeFilter.class);
    addType(ExcludeFilter.class);
    addType(PropertyIsLike.class);

    // spatial filters
    addType(BBOX.class);
    addType(Contains.class);
    //addType(Crosses.class);
    addType(Disjoint.class);
    //addType(Equals.class);
    addType(Intersects.class);
    //addType(Overlaps.class);
    //addType(Touches.class);
    addType(Within.class);
    addType(DWithin.class);
    addType(Beyond.class);

    //temporal filters
    addType(After.class);
    addType(Before.class);
    addType(Begins.class);
    addType(BegunBy.class);
    addType(During.class);
    addType(Ends.class);
    addType(EndedBy.class);
    addType(TContains.class);
    addType(TEquals.class);
}
 
Example #3
Source File: ElasticFilterTest.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testPropertyIsNull() {
    PropertyIsNull filter = ff.isNull(ff.property("prop"));
    Map<String,Object> expected = ImmutableMap.of("bool", ImmutableMap.of("must_not",
            ImmutableMap.of("exists", ImmutableMap.of("field", "prop"))));

    builder.visit(filter, null);
    assertTrue(builder.createCapabilities().fullySupports(filter));
    assertEquals(expected, builder.getQueryBuilder());
}
 
Example #4
Source File: ElasticFeatureFilterIT.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testGetFeaturesWithIsNullFilter() throws Exception {
    init();
    FilterFactory ff = dataStore.getFilterFactory();
    PropertyIsNull f = ff.isNull(ff.property("security_ss"));
    SimpleFeatureCollection features = featureSource.getFeatures(f);
    assertEquals(1, features.size());
}
 
Example #5
Source File: PropertyIgnoringFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final PropertyIsNull filter, final Object extraData) {
  if (!usesProperty(filter)) {
    return Filter.INCLUDE;
  }
  return super.visit(filter, extraData);
}
 
Example #6
Source File: PropertyIgnoringFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final PropertyIsNull filter, final Object extraData) {
  if (!usesProperty(filter)) {
    return Filter.INCLUDE;
  }
  return super.visit(filter, extraData);
}
 
Example #7
Source File: CriteriaVisitor.java    From geomajas-project-server with GNU Affero General Public License v3.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Object visit(PropertyIsNull filter, Object userData) {
	String propertyName = getPropertyName(filter.getExpression());
	String finalName = parsePropertyName(propertyName, userData);
	return Restrictions.isNull(finalName);
}
 
Example #8
Source File: FilterNode.java    From sldeditor with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Sets the filter.
 *
 * @param filter the new expression
 * @param filterConfig the filter config
 */
public void setFilter(Filter filter, FilterConfigInterface filterConfig) {
    this.filter = filter;
    this.filterConfig = filterConfig;

    setDisplayString();

    this.removeAllChildren();

    TypeManager.getInstance().reset();

    if (filterConfig != null) {
        FilterName filterName = filterConfig.getFilterConfiguration();

        if (filter instanceof Not) {
            setNotFilter(filter, filterName);
        } else if (filter instanceof LogicFilterImpl) {
            setLogicFilter(filter, filterName);
        } else if (filter instanceof BinaryTemporalOperator) {
            setExpressionParameter(
                    ((BinaryTemporalOperator) filter).getExpression1(),
                    filterName.getParameter(0));
            setExpressionParameter(
                    ((BinaryTemporalOperator) filter).getExpression2(),
                    filterName.getParameter(1));
        } else if (filter instanceof PropertyIsNull) {
            setExpressionParameter(
                    ((PropertyIsNull) filter).getExpression(), filterName.getParameter(0));
        } else if (filter instanceof PropertyIsBetween) {
            setExpressionParameter(
                    ((PropertyIsBetween) filter).getLowerBoundary(),
                    filterName.getParameter(0));
            setExpressionParameter(
                    ((PropertyIsBetween) filter).getExpression(), filterName.getParameter(1));
            setExpressionParameter(
                    ((PropertyIsBetween) filter).getUpperBoundary(),
                    filterName.getParameter(2));
        } else if (filter instanceof PropertyIsLike) {
            setExpressionParameter(
                    ((PropertyIsLike) filter).getExpression(), filterName.getParameter(0));
            setExpressionParameter(
                    ff.literal(((PropertyIsLike) filter).getLiteral()),
                    filterName.getParameter(1));
            setExpressionStringSizeParameter(
                    ff.literal(((PropertyIsLike) filter).getWildCard()),
                    filterName.getParameter(2),
                    1,
                    true);
            setExpressionStringSizeParameter(
                    ff.literal(((PropertyIsLike) filter).getSingleChar()),
                    filterName.getParameter(3),
                    1,
                    true);
            setExpressionStringSizeParameter(
                    ff.literal(((PropertyIsLike) filter).getEscape()),
                    filterName.getParameter(4),
                    1,
                    true);
            setExpressionParameter(
                    ff.literal(((PropertyIsLike) filter).isMatchingCase()),
                    filterName.getParameter(5));
        } else if (filter instanceof BinarySpatialOperator) {
            setBinarySpatialOperator(filter, filterName);
        } else if (filter instanceof BinaryComparisonAbstract) {
            setBinaryComparisonAbstract(filter, filterName);
        } else if (filter instanceof FidFilterImpl) {
            FidFilterImpl fidFilter = (FidFilterImpl) filter;

            for (Identifier identifier : fidFilter.getIdentifiers()) {
                setExpressionParameter(ff.literal(identifier), filterName.getParameter(0));
            }
        }
    }
}
 
Example #9
Source File: FilterPanelv2.java    From sldeditor with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Adds the filter.
 *
 * @param node the node
 * @return the filter
 */
private Filter addFilter(FilterNode node) {
    Filter nodeFilter = node.getFilter();

    FilterConfigInterface filterConfig = node.getFilterConfig();

    if (nodeFilter instanceof LogicFilterImpl) {
        List<Filter> filterList = new ArrayList<>();

        createFilterList(node, filterList);

        return filterConfig.createLogicFilter(filterList);
    }

    List<Expression> parameterFilter = new ArrayList<>();

    if (originalFilter instanceof FidFilterImpl) {
        createExpressionParameterList(node, 1, parameterFilter);
    } else if (originalFilter instanceof BinaryTemporalOperator) {
        createExpressionParameterList(node, 2, parameterFilter);
    } else if (originalFilter instanceof PropertyIsBetween) {
        createExpressionParameterList(node, 3, parameterFilter);
    } else if (originalFilter instanceof PropertyIsNull) {
        createExpressionParameterList(node, 1, parameterFilter);
    } else if (originalFilter instanceof PropertyIsLike) {
        createExpressionParameterList(node, 6, parameterFilter);
    } else if (originalFilter instanceof BinarySpatialOperator) {
        createExpressionParameterList(node, 2, parameterFilter);
    } else if (originalFilter instanceof BinaryComparisonAbstract) {
        if (originalFilter instanceof Not) {
            createExpressionParameterList(node, 1, parameterFilter);
        } else if (originalFilter instanceof PropertyIsGreaterThan) {
            createExpressionParameterList(node, 2, parameterFilter);
        } else {
            createExpressionParameterList(node, 3, parameterFilter);
        }
    } else {
        return nodeFilter;
    }

    return filterConfig.createFilter(parameterFilter);
}
 
Example #10
Source File: ExtractGeometryFilterVisitor.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Object visit(final PropertyIsNull filter, final Object data) {
  return new ExtractGeometryFilterVisitorResult(infinity(), null);
}
 
Example #11
Source File: ExtractTimeFilterVisitor.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Object visit(final PropertyIsNull filter, final Object data) {
  return new TemporalConstraints();
}
 
Example #12
Source File: FilterToElastic.java    From elasticgeo with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Writes the FilterBuilder for the Null Filter.
 *
 * @param filter the null filter.
 *
 */
public Object visit(PropertyIsNull filter, Object extraData) {
    LOGGER.finest("exporting NullFilter");

    Expression expr = filter.getExpression();

    expr.accept(this, extraData);

    queryBuilder = ImmutableMap.of("bool",
            ImmutableMap.of("must_not", ImmutableMap.of("exists", ImmutableMap.of("field", field))));

    return extraData;
}