On line 1 of Sample 13, as with a number of the previous samples the <target-entity> element has included an id attribute "AnnuityTarget". Although this attribute is optional, it is good practice to include an id in all <target-entity> elements. This allows the Data Mapping Engine to distinguish between different distinct mappings from the same entity to the same target entity type. Consider the following example: The Person entity in the Common Data Store has two Boolean indicators: isBlind and hasDisability. Both map to the same target entity type, Disability, as follows:
1 <map-entity source="Person"> 1 <condition expression="Person.isBlind==true"> 2 <target-entity 3 id="DisabilityBlind" 4 name="Disability" 5 > 6 <set-attribute 7 name="disabilityType" 8 value="DT1" 9 /> 10 </target-entity> 11 </condition> 12 <!-- Create an empty disability record. --> 13 <condition expression="Person.hasDisability==true"> 14 <target-entity 15 id="DisabilityUnspecified" 16 name="Disability" 17 /> 18 </condition> 19 </map-entity>
The first target on lines 1-11 ensures that if an applicant indicates that they are blind then a disability record of type blindness is created. The second target, lines13-18, checks the hasDisability indicator and if it is set to true then a Disability record of unspecified type is created. By giving the two mappings a distinct id, the Mapping Engine can tell the two mappings apart. Without the id, the second mapping will not be processed.