fix #1263 FilterUtils wrong usage of this removed most of the places#1285
Conversation
… of the places
mbarto
left a comment
There was a problem hiding this comment.
Not the proper way to fix this. You should simply avoid storing stuff in this or FilterUtils and pass all the needed values in function calls.
|
|
||
| toOGCFilter: function(ftName, json, version, sortOptions = null, hits = false, format = null, propertyNames = null) { | ||
| try { | ||
| this.objFilter = (json instanceof Object) ? json : JSON.parse(json); |
There was a problem hiding this comment.
the JSON.parse has disappeared?
| */ | ||
| processOGCCrossLayerFilter: function(crossLayerFilter) { | ||
| let ogc = this.ogcSpatialOperator[crossLayerFilter.operation].startTag; | ||
| processOGCCrossLayerFilter: function(crossLayerFilter, nsplaceholder) { |
There was a problem hiding this comment.
put a default value of "ogc" for nsplaceholder
| FilterUtils.setOperatorsPlaceholders("{namespace}", "ogc"); | ||
|
|
||
| let filter = FilterUtils.processOGCCrossLayerFilter(crossLayerFilterObj); | ||
| let filter = FilterUtils.processOGCCrossLayerFilter(crossLayerFilterObj, "ogc"); |
There was a problem hiding this comment.
Remove "ogc" argument, we cannot change public methods behaviour
| ogc += ogcSpatialOperator[crossLayerFilter.operation].endTag; | ||
| return ogc; | ||
| }, | ||
| getGmlPointElement: function(coordinates, srsName, version) { |
There was a problem hiding this comment.
These methods were public, so they could be used elsewhere, removing them could break a lot of code
| } | ||
| }); | ||
| }, | ||
| getGetFeatureBase: function(version, pagination, hits, format) { |
|
|
||
| return getFeature; | ||
| }, | ||
| processOGCFilterGroup: function(root) { |
|
|
||
| return ogc; | ||
| }, | ||
| processOGCFilterFields: function(group) { |
|
|
||
| return filter; | ||
| }, | ||
| processOGCSimpleFilterField: function(field) { |
| } | ||
| return filter; | ||
| }, | ||
| ogcDateField: function(attribute, operator, value) { |
| } | ||
| return fieldFilter; | ||
| }, | ||
| cqlDateField: function(attribute, operator, value) { |
| } | ||
| return fieldFilter; | ||
| }, | ||
| processCQLSpatialFilter: function() { |
|
|
||
| return cql + ")"; | ||
| }, | ||
| getCQLGeometryElement: function(coordinates, type) { |
| geometry += ")"; | ||
| return geometry; | ||
| }, | ||
| findSubGroups: function(root, groups) { |
| // please remove when fixed | ||
| FilterUtils.nsplaceholder = "ogc"; | ||
| FilterUtils.setOperatorsPlaceholders("{namespace}", "ogc"); | ||
| FilterUtils.setOperatorsPlaceholders("{namespace}", FilterUtils.nsplaceholder); |
There was a problem hiding this comment.
Not this way: the FilterUtils.setOperatorsPlaceholders function should have a default for the second argument:
setOperatorsPlaceholders: function(placeholder, replacement = "ogc") {
...
}
No description provided.