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

107 pass data through metamorph else #333

Merged
merged 7 commits into from
Oct 13, 2020
Merged

Conversation

dr0i
Copy link
Member

@dr0i dr0i commented Oct 9, 2020

See #107.

dr0i added 2 commits October 8, 2020 16:39
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.
@dr0i dr0i requested review from fsteeg and blackwinter October 9, 2020 07:49
@blackwinter blackwinter linked an issue Oct 9, 2020 that may be closed by this pull request
@dr0i dr0i removed request for blackwinter and fsteeg October 9, 2020 09:04
@dr0i
Copy link
Member Author

dr0i commented Oct 9, 2020

This is not exactly what @blackwinter proposed , but it enables the _else data to be passed through the input data as known (I would say "expected"), i.e. entity events are now also passed to downstream receivers.

A note: _else and the new _elseAndPassEntityEvents are not documented yet (TODO).

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>

@dr0i dr0i requested review from blackwinter and fsteeg October 9, 2020 09:56
Copy link
Member

@blackwinter blackwinter left a 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.

dr0i added 3 commits October 12, 2020 16:22
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):
@dr0i
Copy link
Member Author

dr0i commented Oct 12, 2020

I think everything is good know. What do you think?

@blackwinter
Copy link
Member

Agreed, all conversations are resolved :)

@dr0i dr0i merged commit b8f5ad5 into master Oct 13, 2020
@dr0i dr0i deleted the 107-passDataThroughMetamorphElse branch October 13, 2020 08:08
fsteeg added a commit to metafacture/metafacture-fix that referenced this pull request Dec 1, 2020
fsteeg added a commit to metafacture/metafacture-fix that referenced this pull request Dec 1, 2020
blackwinter pushed a commit that referenced this pull request Dec 13, 2024
blackwinter pushed a commit that referenced this pull request Dec 13, 2024
blackwinter pushed a commit that referenced this pull request Dec 13, 2024
blackwinter added a commit that referenced this pull request Dec 13, 2024
Review by @blackwinter

Co-authored-by: Jens Wille <jens.wille@hbz-nrw.de>
blackwinter pushed a commit that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass data through Metamorph
3 participants