Super Type and Sub Type in Repository

ATG Repository supports the inheritance of Objects through concepts of super-type and sub-type. Sub-type inherits all the properties of Super-type. Super-type can have multiple sub-types.

Following example shows "Library content" can be either "Book" or "Video CD". "Library content" is Super-type and "Book" and "Video CD" are sub-types.



Object Model

<!-- Library content-->
<item-descriptor name="libraryContent" sub-type-property="type">

  <table name="libraryContent" type="primary" id-column-names="id">
    <property name="type" data-type="enumerated">
      <option value="book"/>
      <option value="videoCD"/>
    </property>
    <property name="name"/>
    <property name="size"/>
    <property name="weight"/>
  </table>
</item-descriptor>

<!-- Book-->
<item-descriptor name="book" super-type="libraryContent" sub-type-value="book">
  <table name="book" type="auxiliary" id-column-names="id">
    <property name="pages"/>
  </table>
</item-descriptor>

<!-- Video CD-->
<item-descriptor name="videoCD" super-type="libraryContent" sub-type-value="videoCD">
  <table name="videoCD" type="auxiliary" id-column-names="id">
    <property name="duration"/>
  </table>
</item-descriptor>


Advantages
1. Most of properties from super-type can be reused in sub types.
2. This saves a lot of space in DB.