Separate model for single and multiple documents #191
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using XML Schema
choice
to either allow for the old singular document syntax with all textual information in the document (title, non-sensitive title, description), or to specify the textual info for the entire job, and allow multiple documents each with its own title.This allows us to transition to new structure in the API for multiple documents, while also supporting the old syntax, and be able to validate this structure as well on the API-level.
As Java does not have support for such "sum typing", the generated JAXB-code can not be a perfectly tight fit, so we employ some tricks to have unmarshalled legacy messages to "magically" be viewed as the new structure. Since the new structure is conceptually a generalization of the old (from one document only to multiple documents), the legacy singular document messages does fit as the new multiple documents structure. This is implemented using a bit of Java-fu with internal interfaces to "inject" code into the generated XMLManifest-representations for direct- and portal-jobs.
The method XMLManifest.getDocument() is appropriately marked as
@deprecated, and can be replaced with the unified API for multiple
documents. (
XMLManifest.getDocumentsToSign()
andXMLManifest.getJobInformation()
)