Mapping array references of a core application contact

The method arrayMapping(Entity#ArrayKey) maps array references for Contact entities and subentities. The method by default operates in both directions. You can use the following additional qualifying methods as well:

withMappingDirection(TO_XML)

Specifies that the array reference is mapped to ContactManager.

withMappingDirection(TO_BEAN)

Specifies that the array reference is mapped from ContactManager.

For example, in ClaimCenter, the array of category scores from a vendor performance review is maintained by ContactManager. Therefore, the direction of the array reference is one-way, from ContactManager:

arrayMapping(Contact#CategoryScores)
  .withMappingDirection(TO_BEAN),
withABName(name:String)

Specifies a different name for the array reference on the entity in ContactManager.

Use the fieldMapping method to map all the fields of the entity to which an array reference refers.

For example, the array extension example Extending contacts with an array adds a new entity named ContactServiceState. This entity represents a state in which a vendor contact operates. Each vendor can operate in more than one state, so the example adds an array reference to Contact named ContactServiceArea that references an array of ContactServiceState entities.

Note: The example also creates a ContactManager ContactServiceState entity and a ContactServiceArea array reference on the ContactManager ABContact entity.

To transfer this data to and from a core application, you define the array reference and map the fields of the entity to which it refers in ContactMapper, as follows:

arrayMapping(Contact#ContactServiceArea),
fieldMapping(ContactServiceState#AddressBookUID)
  .withABName(MappingConstants.LINK_ID),
fieldMapping(ContactServiceState#PublicID)
  .withMappingDirection(TO_XML)
  .withABName(MappingConstants.EXTERNAL_PUBLIC_ID),
fieldMapping(ContactServiceState#ServiceState)