company logo

ODC_Options - Application configuration

Inherits:  ODC_Option

An application configuration is a set of hierarchical options, where each option may get a value and any number of suboptions. Application configurations are stored in the application database. Options in a configuration are identified by an option name ( key ), which must be unique within each option list (or sub-option list), but not within the hierarchy.

When creating a new configuration this might be initialized automatically. In order to initialize a configuration properly, the DEF_CONFIG_TEMPLATE option has to be set to the enumeration name for the configuration template. The default name is _OptODE . When no or an invalid configuration name has been defined, a new configuration will be initialized from the one, which has been marked as default configuration.

Setting for the default configuration are defined in an enumeration, which is defined in the resource database. The name of the enumeration has to be set as option value for DEF_CONFIG_TEMPLATE . Each enumerator in the enumeration corresponds to an option. The enumerator name becomes the option key, the condition defined for the enumerator may contain a default value for the option. When the option contains suboptions, those can be defined as subvalues for the enumerator or as type, which contains the name of another enumeration containing a subset of values. This allows reusing definitions for suboptions (e.g. for defining different data sources). When defining subvalues and a type, the option list will contain the generated options from the subvalues and those derived from the type enumeration.

An application may refer to any number of configurations. Configuration names are not case sensitive. The current settings are retrieved as follows:

  1. A configuration with the user's name is searched for. The user name is retrieved from the operating system or from the system variable USER_NAME.
  2. When no configuration has been defined for the user, the configuration name is taken from the DEFAULT_CONFIGURATION settings.
  3. When still no configuration could be located, the first configuration in the list is used as default configuration.

void ODC_Options::CreateConfiguration ( ) {

  changeAccessKey('sk_key');

  

  %DEF_CONFIG_TEMPLATE% = 'myTemplate';

  // initializes new configuration from myTemplate enumeration

  insert('newConfig');

  // add additional options on top level

  options.insert('APPLICATION_TITLE');

  options.value = 'Test application';

  options.insert('APPLICATION_TITLE');

  options.value = 'Test application';

  

  options.provide('Options'); // locate application options

  options.value = 'eabled';   // mark options as acive (must be handles by application

  // create or update application option

  options.options.provide('MESSAGE_ON_ERROR');

  options.options.value = 'true';

  save;

}

Attributes
Keys
  • ik -  - internal feature (not documented)
  • sk_key -  - internal feature (not documented)
Functions