ATG Repository ,Item descriptor properties

Cascading Data relationship: The SQL repository uses the cascade attributes in a <property> tag to better handle hierarchical properties- that is, properties that have the attribute item-type or component-item-type. The Cascade attribute can be set to one or more of the value: insert, update delete
For Example:
<property name=”scenarios” item-type=”scenario” cascade=”update, delete”/>

In below ,whenever the author type repository item is created ,added, updated, or deleted ,the same actions apply to corresponding address repository ,see in below example:

<!-- The "author" item type -->
<item-descriptor name="author">
  <table name="author" id-column-names="author_id" type="primary">
    <property name="name"/>
    <property name="address" item-type="address" cascade="insert, update, delete"/>
  </table>
</item-descriptor>
<!-- The "address" item type -->
<item-descriptor name="address">
  <table name="address" id-column-names="address_id" type="primary">
    <property name="streetAddress"/>
    <property name="city"/>
    <property name="state"/>
    <property name="zip"/>
  </table>
</item-descriptor>

Inheritance: The SQL repository supports a simplified from of inheritance that uses an optional one-to-one relationship between the primary table and an auxiliary table. The sample repository can define one item descriptor that inherits property from another.
<!-- The "clothing" item type, a base type -->
<item-descriptor name="clothing" sub-type-property="type">

  <!-- This is the primary table that holds clothing data -->
  <table name="clothing" type="primary" id-column-names="id">
    <property name="type" data-type="enumerated">
      <option value="shirt"/>
      <option value="shorts"/>
    </property>
    <property name="name"/>
    <property name="description"/>
    <property name="color"/>
    <property name="size"/>
    <property name="shippingWeight"/>
  </table>
</item-descriptor>

<!-- The "shirt" item type is a subclass of "clothing" -->
<item-descriptor name="shirt" super-type="clothing" sub-type-value="shirt">
  <table name="shirt" type="auxiliary" id-column-names="id">
    <property name="season"/>
  </table>
</item-descriptor>

<!-- The "shorts" item type, now a subclass of "clothing" -->
<item-descriptor name="shorts" super-type="clothing" sub-type-value="shorts">
  <table name="shorts" type="auxiliary" id-column-names="id">
    <property name="pleated" data-type="boolean"/>
  </table>
</item-descriptor>
Note: Instances of objects are associated with their superclasses by ID. So, in this example, a shirt ID always has a matching clothing ID.

Transient: this property not persisted in database.The Transient properties never store or read from the persistence data storage. They are readable, writable but not queryable.You can specify a transient property by define a <property> under Item Descriptor, the property tag has associated with table.
Example:
<item-descriptor name="user" sub-type-property="userType">
    <property name="loggedIn" data-type="boolean">
    <table name="user" type="primary" id-column-names="id">
    <property name=”UserType” data-type=”enumerated” coumn-name=”user_type” />

Derived Property: An SQL repository can define derived properties, where one repository item derives property values from another repository item or from another property in the same item. Derived properties are important to data models that use a tree structure, where certain property values are passed down from other properties.
Example: <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>

1 comment:

Unknown said...

good properties description..