-
Notifications
You must be signed in to change notification settings - Fork 34
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
107 pass data through metamorph else #333
Conversation
With the new keyword "_elseAndPassEntityEvents" (set with <data source="_elseAndPassEntityEvents" /> ) the known "_else" is triggered AND entity events for these "_else" sources are fired. With this, data can be passed through metamorph. All "_else" data are handled in receivers like all the other data handled by morph rules. Data which is handled by metamorph rules will NOT be passed through (hence the aptly named "_else"). If you want to use data in the morph AND pass it through, you have to add an explicit rule for this, as usual. See #107.
This is not exactly what @blackwinter proposed , but it enables the A note: Example: Input: <mx:collection>
<mx:record xmlns:mx="http://www.loc.gov/MARC21/slim" id="ID1635091">
<mx:datafield ind1="1" ind2="2" tag="123">
<mx:subfield code="n">123</mx:subfield>
</mx:datafield>
<mx:datafield ind1=" " ind2=" " tag="456">
<mx:subfield code="n">456</mx:subfield>
</mx:datafield>
</mx:record>
</mx:collection>
morph: <rules>
<entity name="07812" >
<data source="12312.n" name="new" />
</entity>
<data source="_elseAndPassEntityEvents" />
</rules> output: <marc:collection>
<marc:record>
<marc:controlfield tag="type"></marc:controlfield>
<marc:datafield tag="078" ind1="1" ind2="2">
<marc:subfield code="new">123</marc:subfield>
</marc:datafield>
<marc:datafield tag="456" ind1=" " ind2=" ">
<marc:subfield code="n">456</marc:subfield>
</marc:datafield>
</marc:record>
</marc:collection> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall 👍, just a few minor (?) details that could be changed.
metafacture-biblio/src/main/java/org/metafacture/biblio/marc21/MarcXmlEncoder.java
Outdated
Show resolved
Hide resolved
metamorph/src/main/java/org/metafacture/metamorph/Metamorph.java
Outdated
Show resolved
Hide resolved
metamorph/src/main/java/org/metafacture/metamorph/Metamorph.java
Outdated
Show resolved
Hide resolved
metamorph/src/test/java/org/metafacture/metamorph/MetamorphTest.java
Outdated
Show resolved
Hide resolved
metamorph/src/test/java/org/metafacture/metamorph/MetamorphTest.java
Outdated
Show resolved
Hide resolved
metamorph/src/test/java/org/metafacture/metamorph/MetamorphTest.java
Outdated
Show resolved
Hide resolved
metamorph/src/test/java/org/metafacture/metamorph/MetamorphTest.java
Outdated
Show resolved
Hide resolved
metamorph/src/test/java/org/metafacture/metamorph/MetamorphTest.java
Outdated
Show resolved
Hide resolved
See #333 (comment) and #333 (comment): - add top-level literal to test behaviour See #333 (comment): - rename variables - add _elseFlattened - add testing _elseFlattened See #333 (comment): - rename and move test
Allow again null values of literals in general, but prohibit it explicitly in the MarcXmlEncoder. - add test Complements ad48cd4. See #333 (comment).
Allow to set only one of '_else', '_elseFlattened' and _'else_Nested'. Warns if it's tried to set multiple times, ignores the superflous setting and just goes on. See #333 (comment):
I think everything is good know. What do you think? |
Agreed, all conversations are resolved :) |
Review by @blackwinter Co-authored-by: Jens Wille <jens.wille@hbz-nrw.de>
Use the default option as in catmandu #333
See #107.