Skip to content

fix #1263 FilterUtils wrong usage of this removed most of the places#1285

Merged
mbarto merged 4 commits into
geosolutions-it:masterfrom
saidaipparla:FilterUtils_wrong_usage_this
Nov 18, 2016
Merged

fix #1263 FilterUtils wrong usage of this removed most of the places#1285
mbarto merged 4 commits into
geosolutions-it:masterfrom
saidaipparla:FilterUtils_wrong_usage_this

Conversation

@saidaipparla

Copy link
Copy Markdown
Contributor

No description provided.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 80.005% when pulling bb76068 on saidaipparla:FilterUtils_wrong_usage_this into 6234225 on geosolutions-it:master.

@mbarto mbarto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 80.0% when pulling 904015c on saidaipparla:FilterUtils_wrong_usage_this into 6234225 on geosolutions-it:master.


toOGCFilter: function(ftName, json, version, sortOptions = null, hits = false, format = null, propertyNames = null) {
try {
this.objFilter = (json instanceof Object) ? json : JSON.parse(json);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the JSON.parse has disappeared?

Comment thread web/client/utils/FilterUtils.jsx Outdated
*/
processOGCCrossLayerFilter: function(crossLayerFilter) {
let ogc = this.ogcSpatialOperator[crossLayerFilter.operation].startTag;
processOGCCrossLayerFilter: function(crossLayerFilter, nsplaceholder) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put a default value of "ogc" for nsplaceholder

FilterUtils.setOperatorsPlaceholders("{namespace}", "ogc");

let filter = FilterUtils.processOGCCrossLayerFilter(crossLayerFilterObj);
let filter = FilterUtils.processOGCCrossLayerFilter(crossLayerFilterObj, "ogc");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "ogc" argument, we cannot change public methods behaviour

ogc += ogcSpatialOperator[crossLayerFilter.operation].endTag;
return ogc;
},
getGmlPointElement: function(coordinates, srsName, version) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods were public, so they could be used elsewhere, removing them could break a lot of code

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 79.996% when pulling 65efb68 on saidaipparla:FilterUtils_wrong_usage_this into 6234225 on geosolutions-it:master.

}
});
},
getGetFeatureBase: function(version, pagination, hits, format) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public


return getFeature;
},
processOGCFilterGroup: function(root) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public


return ogc;
},
processOGCFilterFields: function(group) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public


return filter;
},
processOGCSimpleFilterField: function(field) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public

}
return filter;
},
ogcDateField: function(attribute, operator, value) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public

}
return fieldFilter;
},
cqlDateField: function(attribute, operator, value) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public

}
return fieldFilter;
},
processCQLSpatialFilter: function() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public


return cql + ")";
},
getCQLGeometryElement: function(coordinates, type) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public

geometry += ")";
return geometry;
},
findSubGroups: function(root, groups) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one was public

// please remove when fixed
FilterUtils.nsplaceholder = "ogc";
FilterUtils.setOperatorsPlaceholders("{namespace}", "ogc");
FilterUtils.setOperatorsPlaceholders("{namespace}", FilterUtils.nsplaceholder);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this way: the FilterUtils.setOperatorsPlaceholders function should have a default for the second argument:

setOperatorsPlaceholders: function(placeholder, replacement = "ogc") {
...
}

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 79.974% when pulling 8add8eb on saidaipparla:FilterUtils_wrong_usage_this into 6234225 on geosolutions-it:master.

@mbarto mbarto merged commit 1cd3bd7 into geosolutions-it:master Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants