Derived Properties Using Scripts

The Script deriver class enables dynamic scripts to be used by derived properties. Derived properties using scripts are available for versions, hierarchies, and nodes.

Table 12-1 Property Level Descriptions

Property Level Parameter Object

Version

version

VersionObject

Hierarchy

hierarchy

HierarchyObject

Global Node

node

NodeObject

Local Node

node

LocalNodeObject

For more information, see:

Node Derived Properties

In this context, you are passed a parameter called node. For global properties, the node is a NodeObject. For local properties the node is a LocalNodeObject. A script for a derived property must return a value and the value must be appropriate to the data type of the property that is being evaluated or executed. If the value returned by a script does not match the property data type, then it will be coerced: for example, a null value being returned for a Boolean property will be treated as false.

Note:

Not all Oracle Data Relationship Management property data types have a JavaScript representation. See Data Type Conversions.

Version and Hierarchy Properties

In this context, you use a version parameter referencing a VersionObject or a hierarchy parameter referencing a HierObject. When defining your scripts, a version may not be loaded when the script is evaluated or executed. If a version or hierarchy derived property only accesses other version and hierarchy level properties, then the property is calculated regardless of the version load status. If a version or hierarchy derived property attempts to access node level information, then the version must be loaded or the property calculation will produce an error value. For example, if a version-level property attempts to get the list of orphans, that property will produce an error value when the version is not loaded; after the version is loaded, that same property will produce the correct value.