Spike: MODDICORE-169 Import Holdings - Define changes needed to maintain Holdings creation


There are 2 ways fo how the records can be generated in data-import:

1) Inventory Instances are getting generated from incoming MARC Bibs using the Processor.java in the current implementation of data-import. Such an approach requires keeping mapping rules in a plain JSON file. 

2) There is an alternative approach for generating records from incoming MARCs. The approach is based on MappingManager.java. It requires storing rules in a MappingProfile. This approach has limitations in its implementation. It doesn't allow to map data from MARC leader and indicators. Also, storing mapping rules in a MappingProfile allows the user to modify the default mapping rules less efficiently.   

The 2nd approach does not fit all the business requirements for today, so the decision is to use the 1st approach and make Holdings generation the same way as Instance generation from MARC Bibs.

Changes needed to generate Holdings records from MARC Holdings

Step1 - Create Holdings Procesor. Affected area - data-import-processing-core

    Create a new HoldingsProcesor needed to generate Holdings record by the given mapping rules. The HoldingsProcessor should be written the same principle as the InstanceProcessor
    Create a new MarcToHoldingsMapper similar to MarcToInstanceMapper.

Step2 - Create a handler to generate records. Affected area - mod-inventory

    Create a new handler CreateMarcHoldingsEventHandler that handles the event DI_SRS_MARC_HOLDINGS_RECORD_CREATED.  The new handler should be written in the same principle as CreateInstanceEventHandler.

What the CreateMarcHoldingsEventHandler receives:

  • default mapping rules
  • SRS Holdings record
  • Instance HRID

What the CreateMarcHoldingsEventHandler does:
 - generates Holdings using the corresponding Processor from data-import-processing-core
 - retrieves Inventory Instance by the given HRID, takes instanceId from Instance and sets instanceId to generated Holdings record
 - saves Holdings record to the DB
 - throws DI_INVENTORY_HOLDINGS_CREATED_READY_FOR_POST_PROCESSING, prepare event payload for post-processing.

Step3 - Update MarcHoldingsRecordHridSetKafkaHandler. Affected area - mod-inventory

    The existing handler is written expecting to take the mapping rules from the Mapping profile and use MappingManager to generate Holdings. We have to make it work receiving default rules in the event payload and use HoldingProcessor to generating Holdings. You can take MarcBibInstanceHridSetKafkaHandler.java as an example.


User stories

MODDICORE-175 - Getting issue details... STATUS  

MODINV-483 - Getting issue details... STATUS

MODINV-486 - Getting issue details... STATUS

Open questions

  • Clarify mapping for holdingsTypeId,
  • What changes on UI are needed? Changes on MappingProfile - Enable MARC_HOLDINGS record type, enable Holdings HRID field
  • (From Ann-Marie Breaux (Deactivated)) If a library only has MARC Holdings for some of their Inventory Holdings, and wants to use MARC Bib data to create/update some of the Inventory Holdings not controlled by MARC Holdings, how to we indicate that on the UI? One possibility - if the library selects incoming record = MARC Bib, then allow mapping for all of the Inventory Holdings fields. If the library selects incoming record = MARC Holdings, then grey out/disable the fields controlled by the default MARC Holdings-to-Inventory Holdings map.
  • (from Ann-Marie Breaux (Deactivated) ) If a library uses MARC Holdings, is it OK to grey out/disable the same fields for all libraries, or should that be responsive to which Inventory Holdings fields are controlled by the default map for a particular tenant? Maybe start with it being the same for all libraries, but a future story to make it responsive to the default map?