Mapping foreign keys of a core application contact

The method fkMapping(Entity#ForeignKey) maps foreign keys for Contact entities, subentities, and join tables. The method by default operates in both directions. You can use the following additional qualifying methods as well:

withMappingDirection(TO_XML)
Specifies that the foreign key is mapped to ContactManager.
withMappingDirection(TO_BEAN)
Specifies that the foreign key is mapped from ContactManager.
withABName(name:String)
Specifies a different name for the foreign key on the entity in ContactManager

Use the fieldMapping method to map all the fields of the entity to which a foreign key refers.

For example, the foreign key on ContactAddress that points to an Address object is defined as follows:

fkMapping(ContactAddress#Address),

Additionally, the fields for the Address object must all be defined by using fieldMapping method calls. The code for the Address entity referenced by the foreign key is:

fieldMapping(Address#AddressBookUID)
  .withABName(MappingConstants.LINK_ID),
fieldMapping(Address#PublicID)
  .withMappingDirection(TO_XML)
  .withABName(MappingConstants.EXTERNAL_PUBLIC_ID),
fieldMapping(Address#AddressLine1),
fieldMapping(Address#AddressLine2),
fieldMapping(Address#AddressLine3),
fieldMapping(Address#AddressType),
fieldMapping(Address#City),
fieldMapping(Address#County),
fieldMapping(Address#Country),
fieldMapping(Address#Description),
fieldMapping(Address#GeocodeStatus),
fieldMapping(Address#PostalCode),
fieldMapping(Address#State),
fieldMapping(Address#ValidUntil),
fieldMapping(Address#AddressLine1Kanji),
fieldMapping(Address#AddressLine2Kanji),
fieldMapping(Address#CityKanji),
fieldMapping(Address#CEDEX),
fieldMapping(Address#CEDEXBureau),