The
preferences data port provides a simple way to store a
collection of key-value pairs in a blob in a database.
Each key is a string, and the corresponding value can
be a string, a date, a number or a boolean value.
As with
any other data port, you can create UDM tree nodes that
use the preferences port. When doing so, you must
provide the data port with a blob in which the
preferences are stored. If the UDM node has the 'read'
mode, the data port decodes the preference values from
the blob and produces them as attributes of the node. If
the UDM has 'write' mode, the data port encodes the
node's attributes into the blob.
As with
any other data port, you can create UDM tree nodes that
use the preferences port. When doing so, you must
provide the data port with a blob in which the
preferences are stored. If the UDM node has the 'read'
mode, the data port decodes the preference values from
the blob and produces them as attributes of the node. If
the UDM has 'write' mode, the data port encodes the
node's attributes into the blob.
Like any other data port, the preferences port needs a
data port descriptor that contains the names and types of
the attributes it must store. But it has one other
feature: you can add to its set of attributes simply by
modifying its data port descriptor, without changing
its underlying Java code. In this example, we see four
attributes supported by the data port. Adding a new
attribute, say preferredWindowWidth, is simply a matter of
adding another attribute declaration to the data port
descriptor:
<attribute name="preferredWindowWidth"
type="int"
description="Window width that the user likes"
/>
After adding this attribute to the descriptor, you need
only reconcile your UDMs (via zeroCode's "verify
UDM validity" facility) to add the new attribute to
your UDM. This will cause the data port to include the
new attribute in all future use.