Package org.geotools.filter

Examples of org.geotools.filter.Filter


            LOGGER.finest("setting query request parameters");

            for (int i = 0; i < featureSize; i++) {
                String featureType = (String) typeList.get(i);
                List properties;
                Filter filter;

                // permissive logic: lets one property list apply to all types
                LOGGER.finest("setting properties: " + i);

                if (propertySize == 0) {
View Full Code Here


        } else {
            LOGGER.finest("adding filter to all queries: " + filter);

            for (int i = 0, n = request.queries.size(); i < n; i++) {
                Query query = (Query) request.queries.get(i);
                Filter queryFilter = query.getFilter();

                if (queryFilter != null) {
                    query.addFilter(queryFilter.and(filter));
                } else {
                    query.addFilter(filter);
                }
            }
        }
View Full Code Here

        for (int i = 0, n = locks.size(); i < n; i++) {
            curLock = (LockRequest.Lock) locks.get(i);
            LOGGER.info("curLock is " + curLock);

            String curTypeName = curLock.getFeatureType();
            Filter curFilter = curLock.getFilter();

            FeatureTypeInfo meta = catalog.getFeatureTypeInfo(curTypeName);
            NameSpaceInfo namespace = meta.getDataStoreInfo().getNameSpace();
            FeatureSource source = meta.getFeatureSource();
            FeatureResults features = source.getFeatures(curFilter);

            if( source instanceof FeatureLocking){
                ((FeatureLocking)source).setFeatureLock(fLock);
            }
            FeatureReader reader = null;

            try {
                for (reader = features.reader(); reader.hasNext();) {
                    Feature feature = reader.next();
                    String fid = feature.getID();
                    if( !(source instanceof FeatureLocking)){
                        LOGGER.fine("Lock " + fid +
                                " not supported by data store (authID:"
                                + fLock.getAuthorization() + ")");
                        lockFailedFids.add(fid);
                    }
                    else {
                        Filter fidFilter = filterFactory.createFidFilter(fid);

                        //DEFQuery is just some indirection, should be in the locking interface.
                        //int numberLocked = ((DEFQueryFeatureLocking)source).lockFeature(feature);
                        //HACK: Query.NO_NAMES isn't working in postgis right now,
                        //so we'll just use all.
View Full Code Here

                       
                        // applicable rules
                        for( Iterator it = ruleList.iterator(); it.hasNext(); ) {
                            Rule r = (Rule) it.next();
                            LOGGER.finer("applying rule: " + r.toString());
                            Filter filter = r.getFilter();
                            if ((filter == null) || filter.contains(feature)) {
                                doElse = false;
                                LOGGER.finer("processing Symobolizer ...");
                                Symbolizer[] symbolizers = r.getSymbolizers();
                                processSymbolizers(feature, symbolizers, scaleRange);
                            }
View Full Code Here

                  );
                }
               
                LOGGER.finer( "Transaction Delete:"+element );
                try {
                    Filter filter = delete.getFilter();

                    Envelope damaged = store.getBounds(new DefaultQuery(
                                delete.getTypeName(), filter));

                    if (damaged == null) {
                        damaged = store.getFeatures(filter).getBounds();
                    }

                    if ((request.getLockId() != null)
                            && store instanceof FeatureLocking
                            && (request.getReleaseAction() == TransactionRequest.SOME)) {
                        FeatureLocking locking = (FeatureLocking) store;

                        // TODO: Revisit Lock/Delete interaction in gt2
                        if (false) {
                            // REVISIT: This is bad - by releasing locks before
                            // we remove features we open ourselves up to the danger
                            // of someone else locking the features we are about to
                            // remove.
                            //
                            // We cannot do it the other way round, as the Features will
                            // not exist
                            //
                            // We cannot grab the fids offline using AUTO_COMMIT
                            // because we may have removed some of them earlier in the
                            // transaction
                            //
                            locking.unLockFeatures(filter);
                            store.removeFeatures(filter);
                        } else {
                            // This a bit better and what should be done, we will
                            // need to rework the gt2 locking api to work with
                            // fids or something
                            //
                            // The only other thing that would work would be
                            // to specify that FeatureLocking is required to
                            // remove locks when removing Features.
                            //
                            // While that sounds like a good idea, it would be
                            // extra work when doing release mode ALL.
                            //
                            DataStore data = store.getDataStore();
                            FilterFactory factory = FilterFactory
                                .createFilterFactory();
                            FeatureWriter writer;                           
                            writer = data.getFeatureWriter(typeName, filter,
                                    transaction);

                            try {
                                while (writer.hasNext()) {
                                    String fid = writer.next().getID();
                                    locking.unLockFeatures(factory
                                        .createFidFilter(fid));
                                    writer.remove();
                                }
                            } finally {
                                writer.close();
                            }

                            store.removeFeatures(filter);
                        }
                    } else {
                        // We don't have to worry about locking right now
                        //
                        store.removeFeatures(filter);
                    }

                    envelope.expandToInclude(damaged);
                } catch (IOException ioException) {
                    throw new WfsTransactionException(ioException.getMessage(),
                        element.getHandle(), request.getHandle());
                }
            }

            if (element instanceof InsertRequest) {
                if ((request.getWFS().getServiceLevel() & WFSDTO.SERVICE_INSERT) == 0) {
                    // could we catch this during the handler, rather than during execution?
                    throw new ServiceException(
                        "Transaction INSERT support is not enabled");
                }
                LOGGER.finer( "Transasction Insert:"+element );
                try {
                    InsertRequest insert = (InsertRequest) element;
                    FeatureCollection collection = insert.getFeatures();

                    FeatureReader reader = DataUtilities.reader(collection);
                    FeatureType schema = store.getSchema();

                    // Need to use the namespace here for the lookup, due to our weird
                    // prefixed internal typenames.  see
                    //   http://jira.codehaus.org/secure/ViewIssue.jspa?key=GEOS-143
                   
                    // Once we get our datastores making features with the correct namespaces
                    // we can do something like this:
                    // FeatureTypeInfo typeInfo = catalog.getFeatureTypeInfo(schema.getTypeName(), schema.getNamespace());
                    // until then (when geos-144 is resolved) we're stuck with:
                    FeatureTypeInfo typeInfo = catalog.getFeatureTypeInfo(element.getTypeName() );

                    // this is possible with the insert hack above.
                    LOGGER.finer("Use featureValidation to check contents of insert" );
                    featureValidation( typeInfo.getDataStoreInfo().getId(), schema, collection );

                    Set fids = store.addFeatures(reader);
                    build.addInsertResult(element.getHandle(), fids);

                    //
                    // Add to validation check envelope                               
                    envelope.expandToInclude(collection.getBounds());
                } catch (IOException ioException) {
                    throw new WfsTransactionException(ioException,
                        element.getHandle(), request.getHandle());
                }
            }

            if (element instanceof UpdateRequest) {
                if ((request.getWFS().getServiceLevel() & WFSDTO.SERVICE_UPDATE) == 0) {
                    // could we catch this during the handler, rather than during execution?
                    throw new ServiceException(
                        "Transaction Update support is not enabled");
                }
                LOGGER.finer( "Transaction Update:"+element);
                try {
                    UpdateRequest update = (UpdateRequest) element;
                    Filter filter = update.getFilter();

                    AttributeType[] types = update.getTypes(store.getSchema());
                    Object[] values = update.getValues();

                    DefaultQuery query = new DefaultQuery(update.getTypeName(),
View Full Code Here

        Iterator filterIterator = filterList.listIterator();
        this.locks = new ArrayList();

        while (typeIterator.hasNext()) {
            String curType = (String) typeIterator.next();
            Filter curFilter = null;

            if (filterIterator.hasNext()) {
                curFilter = (Filter) filterIterator.next();
            }
View Full Code Here

        } else {
            LOGGER.finest("adding filter to all queries: " + filter);

            for (int i = 0, n = request.queries.size(); i < n; i++) {
                Query query = (Query) request.queries.get(i);
                Filter queryFilter = query.getFilter();

                if (queryFilter != null) {
                    query.addFilter(queryFilter.and(filter));
                } else {
                    query.addFilter(filter);
                }
            }
        }
View Full Code Here

            LOGGER.finest("setting query request parameters");

            for (int i = 0; i < featureSize; i++) {
                String featureType = (String) typeList.get(i);
                List properties;
                Filter filter;

                // permissive logic: lets one property list apply to all types
                LOGGER.finest("setting properties: " + i);

                if (propertySize == 0) {
View Full Code Here

        GetFeatureInfoRequest infoRequest = getRequest();
        Envelope requestExtent = infoRequest.getGetMapRequest().getBbox();
        FilterFactory ffactory = FilterFactory.createFilterFactory();

        try {
            Filter finalLayerFilter;
            Query layerQuery;

            for (int i = 0; i < nLayers; i++) {
                FeatureType schema = layers[i].getFeatureType();
View Full Code Here

                    "Internal error : " + exp.getMessage());
            }

            layer = new DefaultMapLayer(source, style);

            Filter definitionFilter = layers[i].getDefinitionQuery();

            if (definitionFilter != null) {
                Query definitionQuery = new DefaultQuery(source.getSchema()
                                                               .getTypeName(),
                        definitionFilter);
View Full Code Here

TOP

Related Classes of org.geotools.filter.Filter

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.