Search code examples
repositoryatgbccoracle-commerce

In ATG, how can I disallow the creation of a Repository Item of a super type while allowing creation of each subtype in the BCC?


Let's say I have a content repository with an item descriptor, say TypeA.

It has two subtypes TypeX an TypeY

In the BCC, I want authors to be able to create content of type TypeX and TypeY, but not TypeA.


Solution

  • It turns out that you can do both - if only I could have seen the wood for the trees when RTFM.

    https://docs.oracle.com/cd/E24152_01/Platform.10-1/ATGRepositoryGuide/html/s0611itemdescriptorinheritance01.html

    Replace "clothing" with TypeA, "shirt" with TypeX and "shorts" with TypeY

    <!-- 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>
    

    and, if you want TypeA to be instantiatable, then

    <!-- The "clothing" item type, a base type -->
    <item-descriptor name="clothing" sub-type-property="type"
                                     sub-type-value="clothing">
      <!-- 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="clothing"/>
          <option value="shirt"/>
          <option value="shorts"/>
        <property/>
       ...