Real Time Information Director User Documentation

RTID Metadata Language
Hewlett-Packard Company 67 529618-002
new Mapper(branchRecord, "BRANCHID", "BRANCHNAME");
The next statement invokes the new branchMapper to incorporate the external ID into the
enriched record:
public static final EnrichedRecord externalBranchRecord =
branchRecord.enrich(branchMapper.map());
Now we’ll see how the metadata prescribes partitioning for a table called ITEM, which
has a natural key called ITEMID. The metadata creates an enriched record called
itemRecord. The PartitionedKey enrichment is invoked with the name of the partition ID
column, in this case ITEMPID. The partition ID will be created by hashing on the natural
key, ITEMID. The partition parameters are those defined earlier in the file.
public static EnrichedRecord itemRecord =
new EnrichedRecord("ITEM",
new PartitionedKey("ITEMPID",
new HashPartitionId("ITEMID",
partitionParameters)));
The item record is further enriched with an alias, for use in joins:
public static EnrichedRecord aliasedItemRecord =
itemRecord.enrich(new Alias("I"));
Next are various statements to specify hashing on the natural key for other tables. For
brevity, we’ll skip to something different: a case in which the Director must assign an
artificial key.
The object in question is a Checkout from the library. The Director has to assign a
unique key to identify the checkout transacation. The following lines create a
PartitionedKeyDispenser object to assign the keys. The call to the enrichment specifies
the name of the table, the partition parameters defined earlier, and the block size, which is
the number of keys to preallocate at once. (The NEXTKEY column in the KEYS table
will be updated by this number.)
public static final PartitionedKeyDispenser checkoutDispenser =
new PartitionedKeyDispenser("CHECKOUT", partitionParameters,
KEYS_BLOCK_SIZE);
The next statement enriches the Checkout record with the new artificial key and the
partitionID. The call to PartitionedSystemKey specifies the column that contains the
artificial key (CHECKOUTID), the column that contains the partition ID
(CHECKOUTPID), the name of the key dispenser class, and the partitioning strategy, in
this case, NaturalKeyAffinity. The use of natural-key affinity ensures that the checkout
records are stored in the same partition as the record representing the user’s library card.
The CARDID column is the natural key of the LibraryCard table within the example.
public static EnrichedRecord checkoutRecord =