Proposed SolutionTo enable the ability for additional models to identify additional sets of fields to be copied, the PurchLineMap table map logic and its usage has been refactored. The copy logic has been moved to the PurchLineVersioning class, so the VersioningPurchaseorder class is referencing this class instead of the PurchLineMap table map. The PurchLineVersioning class delegates the logic to copy and determine whether a confirmation is required to a set of class instances, that all implement the PurchLineIVersioningFieldSet interface. Each implementing class is associated with a table map, that describes the set of fields to copy. The PurchLineDictVersioning class is responsible for instantiating the PurchLineIVersioningFieldSet object using reflection, and also for collecting the entire set of fields which must be copied. This data is collected based on all the table maps associated with a PurchLineIVersioningFieldSet implementing class. The diagram below displays the new classes and their dependencies.
Extension scenario walk-throughAssuming an ISVModule2 model wants to extend the PurchLine and PurchLineHistory tables with additional fields that must be copied when creating a new version of a purchase order. To perform this task the ISVModule2 engineer must perform the following steps:
- Add fields through table extensions to the PurchLine and PurchLineHistory tables.
- Create a new table map containing the fields that must be copied, and implement the new table map on the two new table extensions.
Create a new class which implements the PurchLineIVersioningFieldSet interface and implement the required methods.
- The copyVersion method must copy data between two records of the new table map type.
- The fieldSetTableMapId method must return the id of the new table map.
- The isChangeConfirmationRequired method must return true or false based on whether the change to the newly added field values requires a confirmation to be created.