Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Recalculate Bounding Boxes#200

Open
cschroedl-gov wants to merge 12 commits into
geosolutions-it:masterfrom
cschroedl-gov:master-199-recalculate-feature-type-bounding-boxes
Open

Recalculate Bounding Boxes#200
cschroedl-gov wants to merge 12 commits into
geosolutions-it:masterfrom
cschroedl-gov:master-199-recalculate-feature-type-bounding-boxes

Conversation

@cschroedl-gov

@cschroedl-gov cschroedl-gov commented Sep 20, 2016

Copy link
Copy Markdown

Addresses Issue #199. Includes tests. Adds the ability to recursively delete all of the empty child nodes of an XmlElement.

@cschroedl-gov

Copy link
Copy Markdown
Author

Sorry, it wasn't clear from the contributing guidelines, are you ok with multi-commit pull requests, or do you prefer them to be rebase-squashed into one commit?

renc.remove(GSResourceEncoder.KEYWORDS);
renc.remove(GSResourceEncoder.METADATA);
renc.remove(GSResourceEncoder.METADATALINKS);
String body = renc.toString();

@cschroedl-gov cschroedl-gov Sep 20, 2016

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Update: never mind! After adding a method to XmlElement to recursively delete empty children, I was able to use the GS*Encoder classes instead of building the xml with Strings.

When I switched to using GSEncoder classes, I noted that several extra elements were added to the resulting XML documents. These extra empty elements could overwrite existing keywords, metadata, and metadatalinks. While I can remove a hard-coded list of extra elements now, the same kind of problem can occur in the future if new fields are added to the encoders without updating this class. I opted to revert to simple String construction instead of GSEncoder classes to ensure that this functionality would continue to be stable in the future.

String sUrl = baseUrl + "?recalculate=" + calculationMode.getParamValue();
LOGGER.debug("Constructed the following url for bounding box recalculation: " + sUrl);

renc.recursivelyRemoveEmptyChildren();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Here is an example usage of the new XmlElement method.

…d calls, reverted a class member to previous visibility, renamed a variable.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant