Package org.geotools.filter

Examples of org.geotools.filter.FilterAttributeExtractor


                        ids.add(p.getValue());
                    }
                }
            }
        } else {
            FilterAttributeExtractor extractor = new FilterAttributeExtractor();
            idExpression.accept(extractor, null);
            for (String att : extractor.getAttributeNameSet()) {
                ids.add(peekValue(source, namespaceAwareFilterFactory.property(att)));
            }
        }
        if (foreignIds != null) {
            ids.addAll(getForeignIdValues(source));
View Full Code Here


     * @return
     */
    String[] getRequiredAttributes(Query query) {
        Set<String> attributes = new HashSet<String>();

        FilterAttributeExtractor extractor = new FilterAttributeExtractor();
        if (query.getPropertyNames() == Query.ALL_NAMES) {
            for (Expression ex : expressions.values()) {
                ex.accept(extractor, null);
            }
        } else {
            for (String name : query.getPropertyNames()) {
                Expression ex = expressions.get(name);
                ex.accept(extractor, null);
            }
        }

        attributes.addAll(extractor.getAttributeNameSet());
        return attributes.toArray(new String[attributes.size()]);
    }
View Full Code Here

            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

     */
    public static String[] attributeNames(Filter filter, final SimpleFeatureType featureType) {
        if (filter == null) {
            return new String[0];
        }
        FilterAttributeExtractor attExtractor = new FilterAttributeExtractor(featureType);
        filter.accept(attExtractor, null);
        String[] attributeNames = attExtractor.getAttributeNames();
        return attributeNames;
    }
View Full Code Here

     */
    public static Set<PropertyName> propertyNames(Filter filter, final SimpleFeatureType featureType) {
        if (filter == null) {
            return Collections.emptySet();
        }
        FilterAttributeExtractor attExtractor = new FilterAttributeExtractor(featureType);
        filter.accept(attExtractor, null);
        Set<PropertyName> propertyNames = attExtractor.getPropertyNameSet();
        return propertyNames;
    }
View Full Code Here

     */
    public static String[] attributeNames(Expression expression, final SimpleFeatureType featureType) {
        if (expression == null) {
            return new String[0];
        }
        FilterAttributeExtractor attExtractor = new FilterAttributeExtractor(featureType);
        expression.accept(attExtractor, null);
        String[] attributeNames = attExtractor.getAttributeNames();
        return attributeNames;
    }
View Full Code Here

    public static Set<PropertyName> propertyNames(Expression expression,
            final SimpleFeatureType featureType) {
        if (expression == null) {
            return Collections.emptySet();
        }
        FilterAttributeExtractor attExtractor = new FilterAttributeExtractor(featureType);
        expression.accept(attExtractor, null);
        Set<PropertyName> propertyNames = attExtractor.getPropertyNameSet();
        return propertyNames;
    }
View Full Code Here

            FilterEncodingPreProcessor visitor = new FilterEncodingPreProcessor(level);
            query.getFilter().accept(visitor,null);
           
            this.transaction=transaction;
            if( visitor.requiresPostProcessing() && query.getPropertyNames()!=Query.ALL_NAMES){
                FilterAttributeExtractor attributeExtractor=new FilterAttributeExtractor();
                query.getFilter().accept( attributeExtractor, null );
                Set<String> properties = new HashSet<String>(attributeExtractor.getAttributeNameSet());
                properties.addAll(Arrays.asList(query.getPropertyNames()));
                this.query = new Query(query);
                this.query.setPropertyNames((String[]) properties.toArray(new String[0]));
            } else {
                this.query=query;
View Full Code Here

        Query query = new Query(model);
        query.setFilter(filter);
        query.setMaxFeatures(getMaxFeatures(query));
        if(postFilter != Filter.INCLUDE && query.getPropertyNames() != Query.ALL_NAMES) {
            // we need to include the attributes used in the post filter too
            FilterAttributeExtractor fae = new FilterAttributeExtractor();
            postFilter.accept(fae, null);
            String[] attributeNames = fae.getAttributeNames();
            String[] queryProperties = query.getPropertyNames();
            LinkedHashSet<String> atts = new LinkedHashSet<String>();
            atts.addAll(Arrays.asList(queryProperties));
            atts.addAll(Arrays.asList(attributeNames));
            query.setPropertyNames((String[]) atts.toArray(new String[atts.size()]));
View Full Code Here

                querySchema = targetSchema;
                // if we have a post filter we have to include in the queried features also the
                // attribute needed to evaluate the post-filter
                if (postFilter != null) {
                    Set<String> queriedAttributes = new HashSet<String>(Arrays.asList(properties));
                    FilterAttributeExtractor extraAttributeExtractor = new FilterAttributeExtractor();
                    postFilter.accept(extraAttributeExtractor, null);
                    Set<String> extraAttributeSet = new HashSet<String>(
                            extraAttributeExtractor.getAttributeNameSet());
                    extraAttributeSet.removeAll(queriedAttributes);
                    if (extraAttributeSet.size() > 0) {
                        String[] queryProperties = new String[properties.length
                                + extraAttributeSet.size()];
                        System.arraycopy(properties, 0, queryProperties, 0, properties.length);
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.