Support custom mapping files in X12Reader#81
Open
AbhinavMir wants to merge 1 commit into
Open
Conversation
X12Reader was limited to the standards enumerated in FileType. Add an X12Mapping interface (transaction definition + expected ANSI version) so callers can parse files against a mapping that is not built in. - FileType now implements X12Mapping. - CustomX12Mapping builds an X12Mapping from a user-supplied mapping XML stream and version string, reusing the same secured XStream loader. - X12Reader gains constructors accepting any X12Mapping (File, InputStream, Reader, with optional Charset); the existing FileType constructors delegate to them, so the public API is unchanged. Adds tests parsing a file through a custom mapping and verifying the result matches the built-in FileType, plus a version-mismatch rejection test. README documents the new usage.
Member
|
@angelaszek can you please take a look? |
Member
|
Please fix merge conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds the ability to parse X12 files against a user-supplied mapping definition, rather than being limited to the standards enumerated in
X12Reader.FileType.What changed
X12Mappinginterface exposing the transaction definition and the expected ANSI version (the GS08 value). It includes a shared, secured XStream loader so built-in and custom mappings parse identically.FileTypenow implementsX12Mapping.CustomX12Mappingbuilds anX12Mappingfrom a user-supplied mapping XML stream plus a version string.X12Readergains constructors accepting anyX12Mapping(File / InputStream / Reader, with optional Charset). The existingFileTypeconstructors delegate to them, so the public API is fully backward compatible.Usage
Tests
testCustomMappingparses a 270 file through a custom mapping and asserts the result matches parsing the same file via the built-inFileType.testCustomMappingVersionMismatchverifies a wrong version is rejected.README updated with a "Custom mapping files" section. All existing tests, checkstyle, and spotbugs pass.