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

Recalculate Bounding Boxes #200

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

cschroedl-gov
Copy link

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

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

@cschroedl-gov
Copy link
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();
Copy link
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
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 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.

None yet

1 participant