SPIKE: Selecting fields from the inventory instance in the mapping profile

SPIKE: Selecting fields from the inventory instance in the mapping profile

Sources: https://github.com/folio-org/mod-data-export/pull/107

The purpose of the spike is to provide a solution how to amend mapping profile mechanism to allow a user to pick the inventory instance fields that should be included in the export

The solution contains parts relate to selecting fields for instances with and without underlying SRS records:

1) Selecting fields for instances without underlying SRS records. To support the possibility to select fields with empty transformation values and match transformations with appropriate default rules it's necessary to update rulesDefault.json file and add "id" fields to each rule. Such id values should have a "dot-separated" convention like "metadata.updatedDate" to match them with transformation "fieldId" values. For cases with reference data like identifiers the specific value should be add at the end of id. For example for "Identifier LCCN" it will be " identifiers.lccn", for  "Contributors Primary Personal Name" - "contributors.primary.personalname" and so on. The same name convention should be followed for mapping profile transformation "fieldId" values.

The logic of selecting should be implemented in RuleFactory. The previous implementation always builds rules with all default instance ones. The new solution supposes building default instance rules only in case when transformations values are empty. Example sources contain the method RuleFactory.createDefaultByTransfromations contains the logic of selecting base on matching empty transformations for Instance type with default rules by "id". In case if no default rules exist by transformation "fieldId" then such transformation should be skipped.

At the same time Transformations entity should be updated with a new field metadaProperties to support building Metadata of Rule. For example, it's necessary to build a rule for "metadata.createdDate".

2) Selecting fields for instances with underlying SRS records. To support selecting fields from SRS records by transformations the list of SRS records fields should be matched with the list of default rule ids. The list of default rules ids should be built by empty transformations of instance fields.  Example sources contain a new method in MappingService getFieldIdsWithoutTransformations. It calls methods RuleFactory.createDefaultByTransfromations to prepare a list of rules ids. Received ids are matched with SRS fields in SrsRecordConvertorService.getRecordWithTransformationFields to add to the final MARC record output only selected fields.