Hi Andrea,
thanks for your answer. I think the basic design of the ifs (up until
filtering) is correct: Since the DiffFeatureReader can filter and sorts out the
modified features filtered by the native reader. Passing the query fixed our
bug, which was only connect to filtering.
If I understood you correctly, with
if(!canTransact() && transaction != null && transaction !=
Transaction.AUTO_COMMIT) { notAbleToDoAdvancedOperations = true; }
the other blocks must be changed to
if( … || notAbleToDoAdvancedOperations) { … }
right?
But for the filter block it is not needed, if the query is passed to the
DiffFeatureReader, correct?
Should I make a pull request for that?
Regards,
Hendrik
Von: Andrea Aime <[email protected]>
Gesendet: Donnerstag, 29. November 2018 09:45
An: Peilke, Hendrik <[email protected]>
Cc: Geotools-Devel list <[email protected]>
Betreff: Re: [Geotools-devel] Shapefile datastore does not support transactions
and filters correctly
Hi,
looking at the code, I believe that the chain of ifs in the area you're looking
at is wrong... if
there is a transaction going, from that point on any native support for
filtering, sorting, paging should
be foregone, because the DiffFeatureReeader is altering the reader contents
with information
that is not visible to the underlying store implementation.
In other words, get a boolean stating that the store cannot do transactions
natively, but a transaction
is active, and then use it not only to control the creation of
DiffFeatureReader, but also for
the filter, sort, retype and offset steps.
Cheers
Andrea
On Tue, Nov 27, 2018 at 10:38 AM Peilke, Hendrik
<[email protected]<mailto:[email protected]>> wrote:
Hi,
I use a shapefile datastore in conjunction with a transaction. When reading
features of the store, using a filter, I mentioned, that if I have a dirty
state (added or modified features) in the transaction I always get all features
returned regardless of the filter.
I figured out that the problem lies inside ContentFeatureSource
(https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/store/ContentFeatureSource.java):
When getReader(Query query) gets called, it sets in the transaction part the
reader to
new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(reader,
state.getDiff());
The query is not passed to the DiffFeatureReader resulting in a Filter.INCLUDE
filter inside the DiffFeatureReader
(https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/DiffFeatureReader.java),
always returing all features.
In some cases this seems to be handled in some cases inside the getReader(Query
query) in the block following the transaction block, where it adds a new
FilteringFeatureReader on top of the current reader. The problem is, for
shapefiles it never gets there, because canFilter() resolves to true.
My suggestion is to pass the filtert o the DiffFeatureReader by calling
new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(reader,
state.getDiff(), query.getFilter());
Would that be the right way?
Regards,
Hendrik Peilke
________________________________
IBYKUS AG für Informationstechnologie, Erfurt / HRB 108616 - D-Jena / Vorstand:
Helmut C. Henkel, Dr. Lutz Richter, Eckehart Klingner
Vorsitzender des Aufsichtsrates: Dr. Helmut Vorndran
_______________________________________________
GeoTools-Devel mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/geotools-devel
--
Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf
Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU)
phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
http://www.geo-solutions.it http://twitter.com/geosolutions_it
------------------------------------------------------- Con riferimento alla
normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento
generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza
inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è
un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo
scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo,
ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene
notizia. This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by European
Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or
the information herein by anyone other than the intended recipient is
prohibited. If you have received this email by mistake, please notify us
immediately by telephone or e-mail.
________________________________
IBYKUS AG für Informationstechnologie, Erfurt / HRB 108616 - D-Jena / Vorstand:
Helmut C. Henkel, Dr. Lutz Richter, Eckehart Klingner
Vorsitzender des Aufsichtsrates: Dr. Helmut Vorndran
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel