Skip to content
This repository was archived by the owner on Oct 30, 2020. It is now read-only.

Hostcomp relatedRecordsMatched

natlibfi-arlehiko edited this page Jul 17, 2017 · 1 revision

This hook is meant to validate (And possible alter) the matches for host-components set of records. Each record must have a single unique match in the record store.

Validation/alteration process

  1. Find records that have multiple matches in the record store and remove those matches that already are a singular match for some other record
  2. Check if there is single record with no matches
  3. If the record is the host, set the record store host as the match - The record is a host if it doesn't contain a 773-field.
  4. If there is a one record in the corresponding record store host-components set that is not a match for any record in the set, set that record as a match
  5. If the option findMissingByIndex is true attempt to find matches for records based on their record id index. If there is no match for a record "between" two records's id indexes the record can be located by id, e.g.: There is no match for record 124 but there are matches for records 123, 125 and their corresponding matches in the record store have ids 1500 and 1502. Therefore it is assumed that the match for record set record 124 is 1501 in the record store
  6. The validation is successful if each record in both sides (record set and record store) has a single unique match.
  7. If all records from record set have single matches but there are extraneous records in the record store, the validation fails unless the option difference.recordStore is set and the number of extraneous records in the record store is less than or equal to the option's value.
  8. If all records from record store have single matches but there are extraneous records in the record set, the validation fails unless the option difference.recordSet is set and the number of extraneous records in the record set is less than or equal to the option's value.

The following options apply only if the validation fails (These options affect the load-step):

  • onFailure.createAsNew: All records are created as new in the record store. No relation is set to the corresponding host-component set in the store.
  • onFailure.updateEmptyHost: Create all records as components of the the record store host if the host has zero components.

Clone this wiki locally