Package org.geotools.filter

Examples of org.geotools.filter.FilterAttributeExtractor


    @Override
    protected boolean canDelegate(FeatureVisitor visitor) {
        if (visitor instanceof FeatureAttributeVisitor) {
            //pass through unless one of the expressions requires the geometry attribute
            FilterAttributeExtractor extractor = new FilterAttributeExtractor(schema);
            for (Expression e : ((FeatureAttributeVisitor) visitor).getExpressions()) {
                e.accept(extractor, null);
            }

            for (PropertyName pname : extractor.getPropertyNameSet()) {
                AttributeDescriptor att = (AttributeDescriptor) pname.evaluate(schema);
                if (att instanceof GeometryDescriptor) {
                    return false;
                }
            }
View Full Code Here


    @Override
    protected boolean canDelegate(FeatureVisitor visitor) {
        if (visitor instanceof FeatureAttributeVisitor) {
            //pass through if the target schema contains all the necessary attributes
            FilterAttributeExtractor extractor = new FilterAttributeExtractor(featureType);
            for (Expression e : ((FeatureAttributeVisitor) visitor).getExpressions()) {
                e.accept(extractor, null);
            }

            for (PropertyName pname : extractor.getPropertyNameSet()) {
                AttributeDescriptor att = (AttributeDescriptor) pname.evaluate(featureType);
                if (att == null) {
                    return false;
                }
            }
View Full Code Here

        } else {
            SimpleFeatureType returnedSchema = SimpleFeatureTypeBuilder.retype(featureType, propertyNames);
            SimpleFeatureType querySchema = returnedSchema;
           
            if (filter != null && !filter.equals(Filter.INCLUDE)) {
                FilterAttributeExtractor extractor = new FilterAttributeExtractor(featureType);
                filter.accept(extractor, null);
               
                String[] extraAttributes = extractor.getAttributeNames();
                if(extraAttributes != null && extraAttributes.length > 0) {
                    List<String> allAttributes = new ArrayList<String>(Arrays.asList(propertyNames));
                    for (String extraAttribute : extraAttributes) {
                        if(!allAttributes.contains(extraAttribute))
                            allAttributes.add(extraAttribute);
View Full Code Here

        if (fnQuery.getPropertyNames() == Query.ALL_NAMES) {
            returnedSchema = querySchema = getSchema();
        } else {
            returnedSchema = SimpleFeatureTypeBuilder.retype(getSchema(), fnQuery.getPropertyNames());
            FilterAttributeExtractor extractor = new FilterAttributeExtractor(getSchema());
            // we need to let all attribute pass as we're going to make a full filter evaluation
            // in memory
            filter.accept(extractor, null);
            String[] extraAttributes = extractor.getAttributeNames();
            if (extraAttributes == null || extraAttributes.length == 0) {
                // nothing to do
                querySchema = returnedSchema;
            } else {
                List<String> allAttributes = new ArrayList<String>(Arrays.asList(fnQuery.getPropertyNames()));
View Full Code Here

                    "yet there is a odd number of parameters and the last value is not succeeding nor preceeding");
            }
        }
       
        // see if the table is full of attribute independent expressions
        FilterAttributeExtractor extractor = new FilterAttributeExtractor();
        thresholds = new double[(parameters.size() - 1) / 2];
        values = new Expression[thresholds.length + 1];
        for (int i = 1; i < parameters.size(); i++) {
            Expression expression = parameters.get(i);
            if(expression != null) {
                extractor.clear();
                expression.accept(extractor, null);
                if(!extractor.isConstantExpression()) {
                    staticTable = false;
                    thresholds = null;
                    break;
                } else {
                    if(i % 2 == 0) {
View Full Code Here

            q.setTypeName(typeName);
            q.setSortBy(null);
            Filter originalFilter = q.getFilter();
            if (originalFilter != null && !Filter.INCLUDE.equals(originalFilter)) {
                // eliminate the extra attribute the delegate source does not know about
                FilterAttributeExtractor extractor = new FilterAttributeExtractor();
                originalFilter.accept(extractor, null);
                Set<String> filterNames = extractor.getAttributeNameSet();
                Set<String> sourceNames = getSourceAttributes(source);
                if (!sourceNames.containsAll(filterNames)) {
                    MissingPropertiesEraser eraser = new MissingPropertiesEraser(sourceNames);
                    Filter erased = (Filter) originalFilter.accept(eraser, null);
                    q.setFilter(erased);
View Full Code Here

            return super.visit(function, extraData);
        }

        // stable function, is it using attributes?
        if (attributeExtractor == null) {
            attributeExtractor = new FilterAttributeExtractor();
        } else {
            attributeExtractor.clear();
        }
        function.accept(attributeExtractor, null);
View Full Code Here

            throw new IllegalArgumentException(
                    "There must be an equal number of lookup data and return values");
        }
       
        // see if the table is full of attribute independent expressions
        FilterAttributeExtractor extractor = new FilterAttributeExtractor();
        for (int i = 1; i < parameters.size(); i++) {
            Expression expression = parameters.get(i);
            if(expression != null) {
                extractor.clear();
                expression.accept(extractor, null);
                if(!extractor.isConstantExpression()) {
                    staticTable = false;
                    break;
                }
            }
        }
View Full Code Here

                    map("expression", expression, "error", e.getMessage()));
        }

        // Selection of a FilterAttributeExtractor
        if (ecql != null && validAttributes != null) {
            FilterAttributeExtractor filter = new FilterAttributeExtractor();
            ecql.accept(filter, null);
            // Extraction of the attributes, and filter out the valid ones
            List<String> invalids = new ArrayList<String>(Arrays.asList(filter.getAttributeNames()));

            invalids.removeAll(validAttributes);

            // if and only if an invalid attribute is present
            if (!invalids.isEmpty()) {
View Full Code Here

                    error("Unable to parse the following Expression:" + e.getSyntaxError());
                }

                // Selection of a FilterAttributeExtractor
                if (ecql != null) {
                    FilterAttributeExtractor filter = new FilterAttributeExtractor();
                    ecql.accept(filter, null);
                    // Extraction of the attributes
                    List<String> attributes = Arrays.asList(filter.getAttributeNames());
                    // Invalid Attributes
                    List<String> invalid = new ArrayList<String>();
                    // Check on the attributes
                    for(String attribute : attributes){
                        if(!(attribute.equalsIgnoreCase(RESTUploadECQLPathMapper.PATH) ||
View Full Code Here

TOP

Related Classes of org.geotools.filter.FilterAttributeExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.