IBM Curam KeyServer Generation


Introduction


This tutorial aims to explain KeyServer generation technique for unique value for a specific column for one or more tables. Curam provides a technique to generate unique IDs across the application tables based on KeyServer name. The goal is to generate unique numbers wherever they are being used, to avoid potential ID conflicts.

Example: CaseHeader table uses KeyServer Technique for various column like CASEID, CASEREFERENCE etc.

Please find steps to implement KeyServer and its uses below –

  • We need to add entry in dmxfile which is located underEjbServer/Component/Custom/data/initial/KeyServer.dmx locationSample code is provided below –

  <table name="KeyServer"> 
  <column name="keySetCode" type="text"/>
  <column name="nextUniqueIdBlock" type="id"/>
  <column name="humanReadable" type="bool"/>
  <column name="lastUpdated" type="timestamp"/>
  <column name="Annotation" type="text"/>
  <row>
  <attribute name="keySetCode">
        <value>KWPROVIDERREF</value>
    </attribute>
    <attribute name="nextUniqueIdBlock">
        <value>0</value>
    </attribute>
    <attribute name="humanReadable">
        <value>1</value>
    </attribute>
    <attribute name="lastUpdated">
        <value>SYSTIME</value>
    </attribute>
    <attribute name="Annotation">
        <value>Keyset for Provider Referral Reference Number</value>
    </attribute>
  </row>
</table>

above, we added KWPROVIDERREF new KeyServer entry and will use to get unique reference number/ID.

  • We need to write Java implementation to use above created KeyServer so we can make sure newly created KWPROVIDERREF entry is being used. Source Code snippet is available below –

UniqueID uniqueIDObj = UniqueIDFactory.newInstance();
UniqueIDKeySet uniqueIDKeySet = new UniqueIDKeySet();
uniqueIDKeySet.keySetName = "KWPROVIDERREF";
String providerReferenceNumber = Strig.valueOf(uniqueIDObj.getNextIDFromKeySet(uniqueIDKeySet));

System.out.println("providerReferenceNumber :"+providerReferenceNumber);

Leave a Reply

Your email address will not be published. Required fields are marked *