Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

saidaipparla
Copy link
Contributor

No description provided.

@coveralls
Copy link

Coverage Status

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

Copy link
Contributor

@mbarto mbarto left a comment

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

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
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?

@@ -513,12 +771,12 @@ const FilterUtils = {
* }}
* }
*/
processOGCCrossLayerFilter: function(crossLayerFilter) {
let ogc = this.ogcSpatialOperator[crossLayerFilter.operation].startTag;
processOGCCrossLayerFilter: function(crossLayerFilter, nsplaceholder) {
Copy link
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

@@ -486,7 +486,7 @@ describe('FilterUtils', () => {
FilterUtils.nsplaceholder = "ogc";
FilterUtils.setOperatorsPlaceholders("{namespace}", "ogc");

let filter = FilterUtils.processOGCCrossLayerFilter(crossLayerFilterObj);
let filter = FilterUtils.processOGCCrossLayerFilter(crossLayerFilterObj, "ogc");
Copy link
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

return ogc;
},
getGmlPointElement: function(coordinates, srsName, version) {
Copy link
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

Coverage Status

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

@@ -154,277 +641,30 @@ const FilterUtils = {
}
});
},
getGetFeatureBase: function(version, pagination, hits, format) {
Copy link
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
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
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
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
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
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
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
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
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

@@ -484,7 +484,7 @@ describe('FilterUtils', () => {
// this is a workarround for this issue : https://github.com/geosolutions-it/MapStore2/issues/1263
// please remove when fixed
FilterUtils.nsplaceholder = "ogc";
FilterUtils.setOperatorsPlaceholders("{namespace}", "ogc");
FilterUtils.setOperatorsPlaceholders("{namespace}", FilterUtils.nsplaceholder);
Copy link
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

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