Rules of Code Table Merges

Code table files are merged based on precedence order. There is always a more important main/source code table file, and a file which is being merged into it. The second file is called the merge file in the following sections.

The merging rules described below are applied to decide if the <code>, <locale>, <displaynames>, and <name> elements should be merged into the new code table file.

The main code table file of Rules of Code Table Merges, and the merge code table file of Rules of Code Table Merges, illustrate the rules of merging <code>, <codetabledata> and <locale> elements.

Figure 1. Sample Main Code Table File 1
<?xml version="1.0" encoding="UTF-8"?>
<codetables package="curam.codetable">
  <codetable java_identifier="ACCEPTANCESTATUS"
             name="AcceptanceStatus">
    <code default="true" java_identifier="ACCEPTED"
          status="ENABLED" value="ACS1">
      <locale language="en" country="US" sort_order="0">
        <description>Accepted</description>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="PROVISIONAL"
          status="ENABLED" value="ACS2">
      <locale language="en" country="US" sort_order="0">
        <description>Provisional</description>
        <comments>Comments for PROVISIONAL in EN_US</comments>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="REJECTED"
          status="ENABLED" value="ACS3">
      <locale language="en" country="US" sort_order="0">
        <description>Rejected</description>
        <comments>Comments for Rejected in EN_US</comments>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="REMOVED" removed="true"
          status="ENABLED" value="ACS3">
      <locale language="en" country="US" sort_order="0">
        <description>Removed</description>
        <annotation>This message will be removed</annotation>
      </locale>
    </code>
    <codetabledata>
      <locale language="en">
        <comments>Code table comments for
        Country in EN.</comments>
      </locale>
      <locale> language="en" country="US">
        <comments>Code table comments for
        Country in US.</comments>
      </locale>
    </codetabledata>
  </codetable>
</codetables>
Figure 2. Sample Merge Code Table File 1
<?xml version="1.0" encoding="UTF-8"?>
<codetables package="curam.codetable">
  <codetable java_identifier="ACCEPTANCESTATUS"
             name="AcceptanceStatus">
    <code default="true" java_identifier="ACCEPTED"
          status="ENABLED" value="ACS1">
      <locale language="en" country="GB" sort_order="0">
        <description>Passed</description>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="PROVISIONAL"
          status="ENABLED" value="ACS2">
      <locale language="en" country="GB" sort_order="0">
        <description>Pending</description>
        <comments>Comments for PROVISIONAL in EN_GB</comments>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="REJECTED"
          status="ENABLED" value="ACS3">
      <locale language="en" country="GB" sort_order="0">
        <description>Failed</description>
        <comments>Comments for REJECTED in EN_GB</comments>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="UNKNOWN"
          status="ENABLED" value="ACS4">
      <locale language="en" sort_order="0">
        <description>Unknown</description>
        <annotation></annotation>
      </locale>
    </code>
    <codetabledata>
      <locale language="en">
        <comments>Code table comments for
        Country in EN.</comments>
      </locale>
      <locale language="en" country="GB">
        <comments>Code table comments for
        Country in GB.</comments>
      </locale>
    </codetabledata>



  </codetable>
</codetables>

As a result of the merge process the resulting code table file would be:

Figure 3. Resulting Code Table File 1
<codetables package="curam.codetable">
 <codetable java_identifier="ACCEPTANCESTATUS"
     name="AcceptanceStatus">
    <code default="true" java_identifier="ACCEPTED"
          status="ENABLED" value="ACS1">
      <locale language="en" country="US" sort_order="0">
        <description>Accepted</description>
        <annotation></annotation>
      </locale>
      <locale language="en" country="GB" sort_order="0">
        <description>Passed</description>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="PROVISIONAL"
          status="ENABLED" value="ACS2">
      <locale language="en" country="US" sort_order="0">
        <description>Provisional</description>
        <comments>Comments for PROVISIONAL in EN_US</comments>
        <annotation></annotation>
      </locale>
      <locale language="en" country="GB" sort_order="0">
        <description>Pending</description>
        <comments>Comments for PROVISIONAL in EN_GB</comments>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="REJECTED"
          status="ENABLED" value="ACS3">
      <locale language="en" country="US" sort_order="0">
        <description>Rejected</description>
        <comments>Comments for REJECTED in EN_US</comments>
        <annotation></annotation>
      </locale>
      <locale language="en" country="GB" sort_order="0">
        <description>Failed</description>
        <comments>Comments for REJECTED in EN_GB</comments>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="UNKNOWN"
          status="ENABLED" value="ACS4">
      <locale language="en" sort_order="0">
        <description>Unknown</description>
        <annotation></annotation>
      </locale>
    </code>
    <code default="false" java_identifier="REMOVED" removed="true"
          status="ENABLED" value="ACS3">
      <locale language="en" country="US" sort_order="0">
        <description>Removed</description>
        <annotation>This message will be removed</annotation>
      </locale>
    </code>
    <codetabledata>
      <locale language="en">
        <comments>Code table comments for
        Country in EN.</comments>
      </locale>
      <locale> language="en" country="US">
        <comments>Code table comments for
        Country in US.</comments>
      </locale>
      <locale language="en" country="GB">
        <comments>Code table comments for
        Country in GB.</comments>
      </locale>
    </codetabledata>

  </codetable>
</codetables>

The main code table file of Rules of Code Table Merges, and the merge code table file of Rules of Code Table Merges, illustrate the rules of merging <displaynames> and <name> elements.

Figure 4. Sample Main Code Table File 2
<codetables
  hierarchy_name="CarHierarchy"
  package="curam.codetable">
  <codetable java_identifier="CarMake" name="CarMake">
    <displaynames>
      <name country="GB" language="en">Car Make CustomGB</name>
      <name language="lt">Masinos Gamintojas</name>
      <name language="en">Car Make Custom</name>
    </displaynames>
    <code default="false" java_identifier="MITS"
     status="ENABLED" value="CMK1">
      <locale language="en" sort_order="0">
        <description>Mitsubishi</description>
        <annotation/>
      </locale>
    </code>
    <code default="false" java_identifier="AUDI"
      status="ENABLED" value="CMK2">
      <locale language="en" sort_order="0">
        <description>Audi</description>
        <annotation/>
      </locale>
    </code>
  </codetable>
  <codetable java_identifier="CarModel" name="CarModel"
     parent_codetable="CarMake">
    <code default="false" java_identifier="COLT"
     parent_code="CMK1" status="ENABLED" value="CML1">
      <locale language="en" sort_order="0">
        <description>Colt</description>
        <annotation/>
      </locale>
    </code>
    <code default="false" java_identifier="LANCER"
     parent_code="CMK1" status="ENABLED" value="CML2">
      <locale language="en" sort_order="0">
        <description>Lancer</description>
        <annotation/>
      </locale>
    </code>
  </codetable>
</codetables>
Figure 5. Sample Merge Code Table File 2
<codetables
  hierarchy_name="CarHierarchy"
  package="curam.codetable"
>
  <codetable java_identifier="CarMake" name="CarMake">
    <displaynames>
      <name country="US" language="en">Car Make US</name>
      <name language="fr">Marque</name>
      <name language="en">Car Make Core</name>
      <name language="en" country="GB">Car Make CoreGB</name>
    </displaynames>
    <code default="false" java_identifier="MITS"
      status="ENABLED" value="CMK1">
      <locale language="en" sort_order="0">
        <description>Mitsubishi</description>
        <annotation/>
      </locale>
    </code>
    <code default="false" java_identifier="AUDI"
      status="ENABLED" value="CMK2">
      <locale language="en" sort_order="0">
        <description>Audi</description>
        <annotation/>
      </locale>
    </code>
  </codetable>
  <codetable java_identifier="CarModel" name="CarModel"
    parent_codetable="CarMake">
   <displaynames>
       <name language="en">Car Model</name>
    </displaynames>
    <code default="false" java_identifier="COLT"
     parent_code="CMK1" status="ENABLED" value="CML1">
      <locale language="en" sort_order="0">
        <description>Colt</description>
        <annotation/>
      </locale>
    </code>
    <code default="false" java_identifier="LANCER"
    parent_code="CMK1" status="ENABLED" value="CML2">
      <locale language="en" sort_order="0">
        <description>Lancer</description>
        <annotation/>
      </locale>
    </code>
  </codetable>
</codetables>

As a result of the merge process, the resulting code table file would be:

Figure 6. Resulting Code Table File 2
<codetables
  hierarchy_name="CarHierarchy"
  package="curam.codetable">
  <codetable java_identifier="CarMake" name="CarMake">
    <displaynames>
      <name country="GB" language="en">Car Make CustomGB</name>
      <name language="lt">Masinos Gamintojas</name>
      <name language="en">Car Make Custom</name>
      <name country="US" language="en">Car Make US</name>
      <name language="fr">Marque</name>
    </displaynames>
    <code default="false" java_identifier="MITS"
     status="ENABLED" value="CMK1">
      <locale language="en" sort_order="0">
        <description>Mitsubishi</description>
        <annotation/>
      </locale>
    </code>
    <code default="false" java_identifier="AUDI"
     status="ENABLED" value="CMK2">
      <locale language="en" sort_order="0">
        <description>Audi</description>
        <annotation/>
      </locale>
    </code>
  </codetable>
  <codetable java_identifier="CarModel" name="CarModel"
   parent_codetable="CarMake">
    <displaynames>
        <name language="en">Car Model</name>
    </displaynames>
    <code default="false" java_identifier="COLT"
    parent_code="CMK1" status="ENABLED" value="CML1">
      <locale language="en" sort_order="0">
        <description>Colt</description>
        <annotation/>
      </locale>
    </code>
    <code default="false" java_identifier="LANCER"
     parent_code="CMK1" status="ENABLED" value="CML2">
      <locale language="en" sort_order="0">
        <description>Lancer</description>
        <annotation/>
      </locale>
    </code>
  </codetable>
</codetables>