As discussed in the previous chapter, in some cases you may wish to define metadata at runtime. This allows for behaviors that are dynamically controlled. This pattern fits well with user-defined attributes.
To define dynamic attributes, you should have a metadata load phase defined for the data set. Each time the user runs the metadata load, Oracle Enterprise Command Center Framework cleans up all dynamic attributes and inserts a fresh set of dynamically defined attributes. Standard defined attributes that ship with application definition are not affected by this refresh process.
You can define dynamic attributes in either one of two approaches:
Describe Option: A query that is parsed by Oracle Enterprise Command Center Framework to define metadata of the attributes retrieved. No actual execution of the query happens.
Execute Option: A query that is executed to define metadata of attributes.
This option builds the attributes list based on the SQL query select column list metadata. It retrieves all the columns in the select statement and reads the name, type, precision, and scale of each column and creates a corresponding attribute in the data set. If Oracle Enterprise Command Center Framework is configured to run in multi-language mode, then the attribute display name is captured as-is from the database, that output is then parsed, and the administrator is expected to provide translations per enabled language.
Attribute Name | Default Value |
---|---|
ATTRIBUTE_KEY | The key of the attribute as defined in data load queries. This attribute is mandatory and unique per data set. |
DISPLAY_NAME | Column Name, with an empty space replacing the underscore. |
CUSTOM_DISPLAY_NAME | Empty string |
PROFILE | Based on the type value. See the note below. |
SEARCHABLE_FLAG | Attribute type String 'Y', else 'N' |
REFINABLE | Attribute type String 'Y', else 'N' |
SHOW_IN_GUIDED_DISCOVERY | 'Y' in dynamic attributes, 'N' in standard attributes. |
REFINEMENT_BEHAVIOUR | multi-select-or |
REFINEMENT_ORDER | lexical |
SHOW_RECORDS_COUNT | 'N' |
COLLAPSED | 'Y' |
TRANSLATABLE | 'N' |
LANGUAGE | Language of the logged-in user if the user runs it from the administration side; Oracle Enterprise Command Center Framework base language if the user runs it from the metadata load. |
SOURCE_LANGUAGE | LANGUAGE |
For "Profile" in the above table, the default value is based on the type value as follows:
String => String profile
Date => Date profile
Number => PrecisionSize > 0 => columnSize < 10 => float profile => columnSize > 10 => double profile => PrecisionSize < 0 => columnSize < 10 => int profile => columnSize < 10 => long profile
Runs the provided select statement then loops over the returned rows and creates a corresponding dynamic attribute per row. The service expects the below list of columns in the provided select statement.
The query should return all mandatory fields; otherwise, an exception with root cause details will be raised.
Attribute Name | Default Value | Mandatory/Optional | Options |
---|---|---|---|
NAME | Mandatory | ||
Type | Mandatory | ||
Precision | Mandatory | ||
Scale | Mandatory | ||
DISPLAY_NAME | Name, but replacing the underscore with empty space | Optional | |
CUSTOM_DISPLAY_NAME | Empty String | Optional | |
SHOW_IN_GUIDED_DISCOVERY | 'Y' in dynamic attributes, 'N' in standard attributes | Optional | 'Y', 'N' |
REFINEMENT_BEHAVIOUR | multi-select-or | Optional | multi-select-or, multi-select-and, single-select |
REFINEMENT_ORDER | lexical | Optional | Lexical, record count |
SHOW_RECORDS_COUNT | 'N' | Optional | 'Y', 'N' |
COLLAPSED | 'Y' | Optional | 'Y', 'N' |
PROFILE | Based on the type value | Optional | One of the ATTR_PROFILE_KEY in the table ECC_DATASET_ATTR_PROFS |
TRANSLATABLE | 'N' | Optional | |
LANGUAGE | Language of the logged-in user > if the user runs it from the admin side. Oracle Enterprise Command Center Framework Base language > if the user runs it from the metadata load. |
Optional | One of Oracle Enterprise Command Center Framework languages added in ecc.languages in the ecc-config.properties file |
SOURCE_LANGUAGE | Language of the logged-in user > the user runs it from the admin side. Oracle Enterprise Command Center Framework Base language > if the user runs it from the metadata load. Language > If the language existes and the supported language does not exist. |
Optional | One of Oracle Enterprise Command Center Framework languages added in ecc.languages in the ecc-config.properties file |
SEARCHABLE_FLAG | 'N' | Optional | 'Y', 'N' |
REFINABLE | 'N' | Optional | 'Y', 'N' |
SNIPPET_SIZE | 0 | Optional | Integer value |
GROUP_KEY | Optional |
Precedence rules control the disclosure of additional attributes based on a data condition being met. They can also be specified dynamically through an Execute Option only.
Specify a SQL statement that will be executed to return the definition of one or more precedence rules. The underlying service will insert a new rule if one does not exist for the same combination of source, target, and trigger values. Otherwise, it will update and enable an existing one.
In case of an empty value for any of the mandatory fields, the service throws an exception, stops the execution, and provides a clear message about the issue.
Attribute Name | Mandatory/Optional |
---|---|
TRIGGER_INSTANCE_ATTRIBUTE | Mandatory |
TRIGGER_ATTR_VALUE | Mandatory |
TARGET_INSTANCE_ATTRIBUTE | Mandatory |
ENABLED_FLAG | Optional |