Unit 3 - Lesson 1 - Code tables Flashcards
Described codetables
Facilitates the restriction of values
Contains one or more code table items, which consist of the following components:
1)Code to be stored in the database (string)
2)Description which is a displayable text
3)The language setting which contains information relating to the localisation of the code table item
Codes appear in Curam drop-down fields on the client
Codes may be accessed programmatically
Codes need only be unique within a table
Adding new code table items to a code table - use different letter prefix for custom code items to avoid conflicts when upgrading.
Describe locale-specific codes
x
How code tables are stored in database
Stored in 3 database tables:
Code Table Header - a lookup table that groups a set of related codes.
(tableName, timeEntered, defaultCode)
Code Table Item - a translation of a code into a language-specific textual description.
(tableName, code, description, annotation, isEnabled, sortOrder, localeIdentified)
Code Table Hierarchy - the definition of a Code Table Hierarchy, specifying the top-level Code Table and a description of the hierarchy.
(hierarchyName, description, covetable)
How code tables maintained with CTX files
CTX is XML representation of a code table and its values.
Located in component’s covetable directory.
Can customise existing code table or create new ones.
Used to populated the code table database tables.
Used during development instead of Admin suite.
SERVER_COMPONENT_ORDER defines overrides.
SERVER_LOCALE_LIST - environment variable with coma separated list of locales.
The CTGEN build target
CTGEN
- Merges code table definitions according to the component order.
- Translates resultant merged code table file into Java source code and SQL files that populate the database.
- SQL artefacts are generated to %SERVER_DIR%/build/svr/codetable/sql
- Generated Java code compiled and packaged into %SERVER_DIR%/build/jar/codetable.jar
Define simple code tables for your application
code tables package="curam.codetable" - covetable java_identifier="GENDER" name="Gender" -- code default="true" java_identifier="MALE" status="ENABLED" value="SX1" --- locale language="en" sort_order="0" ---- description "Male" ---- annotation --- locale --code - covetable covetable
To use code tables programatically:
String code = curam.codeetable.GENDER.MALE;
Drop-down list
a FIELD can have a target connection mapped to a property based on a code-table domain. If so - drop-down list is displayed containing all enabled code-table entries. Sort order is alphabetical - but can be overridden by setting a sort order for each entry.
How to display a scrollable list
FIELD LABEL="Field.Label.Gender" USE_BLANK="true" HEIGHT=2 USE_DEFAULT="false" CONNECT TARGET CONNECT FIELD
CTGEN target and relevant targets
Note: build ctgen must be executed whenever a change is made to a CTX file.
ctgen must always be followed by build database
You must also perform a build client for the changed to be picked up on the client side.
What CTGEN produces
Produces code table SQL file to place the codes on the database and a symbol definition file, which is a standard Java class file. Java file contacting constants for code table identifiers used in the code table XML file. build/svr/codetable/gen Two files will be produced for each defined code table.
Code Table Hierarchy
Links multiple code tables into several levels.
By selecting a code at one level, you reduce the number of codes at the next level.
Note, lowest-level code is returned and stored, but the parents can be found via the covetable API.
Displaying Codes based on a Hierarchy
FIELD element has a CONTROL attribute. It can be set to CT_HIERARCHY_HORIZONTAL (default) or CT_HIERARCHY)VERTICAL.
Configure Codes using Admin suite
Dynamic, on the fly.
Publish so changes are picked up by the application
All changes must be reflected back to the CTX files.