Skip to content

Commit

Permalink
Make it so that returning Filter.EXCLUDE from ClientTransactionAccess…
Browse files Browse the repository at this point in the history
…or.getUpdateFilter(String propName) means the filter referencing that property is not encodable to the backend

git-svn-id: http://svn.osgeo.org/geotools/trunk@38849 e5c1c795-43da-0310-a71f-fac65c449510
  • Loading branch information
groldan committed Jun 29, 2012
1 parent b901f22 commit 046e326
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Expand Up @@ -126,12 +126,21 @@
* say with certainty exactly how the logic for that part of this works, but the test suite does
* seem to test it and the tests do pass.
* </p>
* <p>
* Since GeoTools 8.0, the {@link ClientTransactionAccessor} interface can also be used to instruct
* the splitter that a filter referencing a given {@link PropertyName} can't be encoded by the
* back-end, by returning {@link Filter#EXCLUDE} in
* {@link ClientTransactionAccessor#getUpdateFilter(String) getUpdateFilter(String)}. This is so
* because there may be the case where some attribute names are encodable to the back-end's query
* language, while others may not be, or may not be part of the stored data model. In such case,
* returning {@code Filter.EXCLUDE} makes the filter referencing the property name part of the
* post-processing filter instead of the pre-processing filter.
*
* @author dzwiers
* @author commented and ported from gt to ogc filters by saul.farber
* @author ported to work upon {@code org.geotools.filter.Capabilities} by Gabriel Roldan
*
*
*
*
* @source $URL$
* @since 2.5.3
*/
Expand Down Expand Up @@ -801,8 +810,13 @@ public Object visit(PropertyName expression, Object notUsed) {
Filter updateFilter = (Filter) transactionAccessor.getUpdateFilter(expression
.getPropertyName());
if (updateFilter != null) {
changedStack.add(updateFilter);
preStack.push(updateFilter);
if(updateFilter == Filter.EXCLUDE){
// property name not encodable to backend
postStack.push(expression);
}else{
changedStack.add(updateFilter);
preStack.push(updateFilter);
}
} else
preStack.push(expression);
} else {
Expand Down
Expand Up @@ -43,7 +43,10 @@ public interface ClientTransactionAccessor {
* Returns all the filters of updates that affect the attribute in the expression ORed together.
*
* @param attributePath the xpath identifier of the attribute.
* @return all the filters of updates that affect the attribute in the expression ORed together.
* @return all the filters of updates that affect the attribute in the expression ORed together,
* {@link Filter#EXCLUDE} if the attribute path is not supported/encodable to the backend
* (and hence any filter including it shall only be evaluated at runtime), or {@code null} if no behavior
* change is to be applied.
*/
Filter getUpdateFilter(String attributePath);

Expand Down

0 comments on commit 046e326

Please sign in to comment.