An item descriptor defines a derived property value through <derivation> and <expression>tags, as follows:

<property name=target-property [attributes]...>
   <derivation  [attributes]...>
       <expression> source-property </expression>
       ...
   </derivation>
</property>

The <derivation> tag encloses one or more <expression> tags. Each <expression> tag encloses a repository item property name, which provides one potential source of the derived value. <derivation> tag attributes specify how the expressions are parsed to provide a value.

For example, an organization might be a hierarchy of divisions, departments, and employees. A repository represents this hierarchy with the item descriptors division, department, and employee, respectively. Each item descriptor defines a spendingLimit property. A business rule might specify that an employee’s spending limit, unless explicitly set for that employee, is derived from the employee’s department. If no department spending limit is set, it is derived from the department’s division.

This derived property relationship is represented in a repository definition file as follows:

<item-descriptor name="employee">
   ...
   <property name="department" item-type="department"/>
   <property name="empSpendingLimit" data-type="int"/>
   <property name="spendingLimit" writable="false">
     <derivation>
       <expression>empSpendingLimit</expression>
       <expression>department.spendingLimit</expression>
     </derivation>
   </property>
 </item-descriptor>

<item-descriptor name="department">
   ...
   <property name="division" item-type="division"/>
   <property name="deptSpendingLimit" data-type="int"/>
   <property name="spendingLimit" writable="false">
     <derivation>
       <expression>deptSpendingLimit</expression>
       <expression>division.divSpendingLimit</expression>
     </derivation>
   </property>
 </item-descriptor>

<item-descriptor name="division">
   ...
   <property name="divSpendingLimit" data-type="int"/>
</item-descriptor>
Recursive Properties Notation

A derived property expression can specify multiple levels of subproperties. For example, an employee’s spending limit might be derived as follows:

<item-descriptor name="employee">
  <property name="department" item-type="department"/>
  <property name="spendingLimit" data-type="int" writable="false">
    <derivation>
      <expression>department.employeeDefaultInfo.spendingLimit</expression>
    </derivation>
  </property>
</item-descriptor>

<item-descriptor name="department">
   <property name="employeeDefaultInfo" item-type="employeeInfo"/>
   <property name="deptSpendingLimit" data-type="int"/>
 </item-descriptor>

<item-descriptor name="employeeInfo">
  <property name="spendingLimit" data-type="int" writable="false"/>
  <property name="officeLocation" data-type="string"/>
</item-descriptor>
Writable and Non-writable Derivations

The firstNonNull derivation method must be non-writable, unless you set a writable override property for the derived property. You can set a property to be not writable like this:

<property name="spendingLimit" data-type="int" writable="false"/>

The derivation methods firstWithAttribute and firstWithLocale can be writable, even if the property does not define a writable override property. See Override Properties in this section for more information.


Copyright © 1997, 2014 Oracle and/or its affiliates. All rights reserved. Legal Notices