IBM Cúram CodeTable Overview


Introduction


This post explain about CodeTable development, implementation and it’s uses in Cúram Product. This tutorial will have explanation with screenshot so user can understand easily and quickly.

Code table files allow a Cúram application to use a level of indirection when storing commonly used constants on the database. Like message files, code table files are shipped with Cúram and can be customized by adding new code table files to new components in the SERVER_DIR/components/<custom>/codetable directory, where <custom> is any new directory created under components that conforms to the same directory structure as components/core. Code table files can contain one code table or a number of code tables that are linked as a hierarchy.

Generating code tables produces two outputs: a code table SQL file to place the codes on the database, and a symbol definition file (a standard Java class file). The symbol definition file is a Java file containing constants for code table identifiers used in the code table XML file.


Code Table File Format


The code table file is an XML document which is made up of a number of distinct elements.We can use umber of editor to develop codetable like editplus, notepad++, eclipse etc.

Sample Codetable: Below find Sample code table example for coutry name as CT_Country.ctx

<?xml version="1.0" encoding="UTF-8"?><codetables package="curam.codetable">     <codetable name="Country" java_identifier="COUNTRY"> <code status="ENABLED" default="false" value="UNKWN" java_identifier=""> <locale sort_order="0" language="en">                 <description>Unknown</description>                 <annotation/>             </locale> <locale sort_order="0" language="es">                 <description>Desconocido</description>                 <annotation/>             </locale> </code> <code default="false" java_identifier="FRANCE" status="ENABLED" value="FR"> <locale sort_order="0" language="en">                 <description>France</description>                 <annotation/>             </locale> <locale sort_order="0" language="es">                 <description>Francia</description>                 <annotation/>             </locale> </code> <code default="false" java_identifier="" status="ENABLED" value="AF"> <locale sort_order="0" language="en">                 <description>Afghanistan</description>                 <annotation/>             </locale> <locale sort_order="0" language="es">                 <description>Afganistán</description>                 <annotation/>             </locale> </code> </codetable> </codetables>

Pictorial Representation of State Drop down:

2016-07-25 11_12_52-Curam Spec

2016-07-25 11_07_47-Curam Spec

Above example display a code table to represent country name and State as a code table for curam user interface.

Please find high level explanation for code table element below –

  • The <codetables> element is the root element of a code table file and it groups all other elements together.
  • The <description> element is an optional sub-element below the <codetables> root. It is used to define a description for the code tables. It should be listed first, before the other sub-element, <codetable>, of <codetables>. It should only be listed once. There are no attributes for the description element.
  • The <codetable> element is a sub-element below the <codetables> root. The <codetable> element should follow the <description> element, if it’s specified. For an ordinary code table file definition only a single <codetable> element can be defined. If a hierarchy_name attribute has been specified in the <codetables> multiple <codetable> elements are allowed as long as they are linked correctly in a hierarchy.

    The codetable element groups a number of <code> elements together and an optional <codetabledata> element.

  • The optional <locale> element can occur multiple times for the <codetabledata> element. Each <locale> element can contain one optional <comments> element.
  • The <code> element is a sub-element of <codetable> and groups a number of <locale> elements together.
  • The <annotation> element is used to provide an annotation to the code. The annotation element has no attributes.

CodeTable Example


 This section will explain about code table and it uses in curam application and how to implements by Developer.

CodeTable files always stay in SERVER_DIR/components/<custom>/codetable directory and ctgen ant target used to build the artifacts.

2016-07-24 17_22_02-Photos

Please find steps to develop new code table –

  • Navigate the custom folder to create new code table name as CT_ClientContactType.ctx under codetable folder.
<?xml version="1.0" encoding="UTF-8"?> <codetables package="curam.codetable">   <codetable     java_identifier="CLIENTCONTACTTYPE"     name="ClientContactType"   >     <displaynames>       <locale language="en">Client Contact Type</locale>     </displaynames>     <code default="false" java_identifier="" status="ENABLED" value="CCT1">       <locale         language="en"         sort_order="0"       >         <description>In-Person</description>         <annotation/>       </locale>     </code>     <code default="false" java_identifier="" status="ENABLED" value="CCT2">       <locale language="en" sort_order="0">         <description>Phone</description>         <annotation/>       </locale>     </code>     <code default="false" java_identifier="" status="ENABLED" value="CCT3">       <locale         language="en"         sort_order="0"       >         <description>Email</description>         <annotation/>       </locale>     </code>   </codetable> </codetables>
  • In order to associate this code table with the user interface and server interface we need to create new domain definition of type code table. We will use RSA for this step. Please find screenshot as given below –

2016-07-25 14_27_04-Curam Spec

2016-07-25 14_24_33-Curam Spec

  • Associate above created Domain Definition with the attribute and struts using RSA which help to display it as a drop down on the screen.

2016-07-25 14_29_37-Curam Spec

  • Now we have to create Facade class, method and User Interface Metadata (*.uim) files. please find screenshot below –

2016-07-25 14_32_20-Curam Spec

UIM:

2016-07-25 14_36_55-Curam Spec

  • As, We already explained required Ant Target for code table in our previous post. Please follow those post for detailed knowledge for ant target using IBM Curam Ant Targets Video Explanation link.
  • Link user interface metadata file with the Shortcut Section Panel(*.ssp) to accessUIM file from shortcut Section Panel.
  • Execute Build ctgene and databse Ant Target on EJBSERVER side and build client on webclient to impact change on the screen.
  • Now Start all related Server(s) like Server, RMI & Tomcat and access uim from the ssp file it opens as model window. Code table will display as drop down list. please find the screenshot as given below –

2016-07-25 11_15_50-Curam Spec

 


Update Existing Code Table


   Curam is providing options to update already exiting file to reuse it in your project. Code table files are merged based on SERVER COMPONENT Order when that file available in various module so custom folder will have highest priority to reflect your changes. We need to analyze impact of Code File changes before making update as various module shared same file and representation of values is different based on location.

Please follow below steps to customize code table from Out of the Box (OOTB) –

  • Create codetable folder under Custom folder, if it is not available.
  • Copy Code table file which user wants to update from the OOTB and paste it on codetable folder which user created using above step.
  • Remove other code and keep only those which user wants to update.
  • Update values as per your requirement and do the required Ant Build targets like ctgen, database and client.
  • Navigate the User interface metadata (*.uim) file to see the impact of changes. Please see screenshot below –

For Example, We want to add one code in the above code table (CT_ClientContactType.ctx) and right now code table available in the OOTB, please follow steps to add new code as sample in the above code table –

  • Copy code table from the OOTB to custom/codetable folder.
  • Remove all exiting code from the code table and new code only, please find custom code table as given below –
<?xml version="1.0" encoding="UTF-8"?> <codetables package="curam.codetable">   <codetable     java_identifier="CLIENTCONTACTTYPE"     name="ClientContactType"   >     <displaynames>       <locale language="en">Client Contact Type</locale>     </displaynames>            <code default="false" java_identifier="SMS" status="ENABLED" value="CCT4">       <locale         language="en"         sort_order="0"       >         <description>SMS</description>         <annotation/>       </locale>     </code>   </codetable> </codetables>
  • Complete all required ant build like ctgen, database and Client to start showing changes.
  • Navigate the UIM file from the Shortcut Section Panel, now SMS option will be available in the drop down –

2016-07-25 15_14_45-Curam Spec

 


Code Table Hierarchy


Code table files can define a single code table or a hierarchy of code tables. A hierarchy is where multiple code tables are linked into a number of levels. Selecting a code at a particular level will reduce the number of selections available at the next level. Any number of levels in a code table hierarchy is supported.

Best Example of Code table hierarchy is Country, State and City relationship on address fields.

Example: if you select country as India then in State drop down only states belongs to India will be available and if user selected state as UP then all city related to UP will be available in City Drop Down so Code table hierarchy is helping to filter drop down values based on selection of parent code.

Example: TBD


Update CodeTable Value RunTime


An User can update or create new code table at run time using IBM Curam Admin portal. sysadmin user is configured in curam OOTB to update or create new code table while your application is up and running, server restart not restart not required as user can publish it online.

These changes will go once server restart so in order to retain those change we need to update or create its respective files in the code base and check-in.

It is very important feature to update code table online and publish but we need to change the codebase as well so changes will be deployed when server restart and do the fresh build.

Please follow below steps to update newly added code SMS to Eamil & SMS –

  • Login to Curam Application using user sysadmin or its equivalent user.

2016-07-25 15_34_29-Curam Spec

  • Click on System Configuration from top of the panel and click on Application Data using SSP (Left Hand Side Panel)

2016-07-25 15_36_47-Curam Spec

 

  • Click on Code Tables option to update or add new code table.  New Tab will open and user will get option to update or create new code table.

2016-07-25 16_24_11-Curam Spec

  • Enter the code table name in the text box and click on Search button then it will search code table and it will be available on below list. By clicking on toggle button an user can do operation like Edit, add new Code, Edit code, Delete and others. Please find screenshot below –

2016-07-25 16_28_51-Curam Spec

  • Clicking on a particular row user can update code description as we are updating from SMS to SMS & EMail

2016-07-25 16_36_52-Curam Spec

 

  • Click on Save button to save your changes. Also Click on Publish button to publish your changes. Once it is publish can navigate the user interface to validate your changes.

2016-07-25 16_41_43-Curam Spec

  • Now, We have to update our codebase for future release as these changes will go once server restart.

 

Hope you understand the concept of code table, please refer IBM documentation center for more details.

Leave a Reply

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