2012-09-21 38 views
0

我想繼承「CONTACTINFO」項目,並創建一個新的項目描述符..像這樣的東西下面給出..項目描述符繼承了「CONTACTINFO」

<item-descriptor name="testContactInfo" super-type="contactInfo"> 
    <table name="test_contact_info" type="auxiliary" id-column-name="contact_id" shared-table-sequence="1"> 
     <property name="fixedlinenumber" column-name="fixed_line_num" data-type="string"/> 
    </table> 
</item-descriptor> 

我得到以下錯誤當我啓動服務器。

14:19:52,856 ERROR [ProfileAdapterRepository] Error parsing template: atg.repository.RepositoryException: Your item-descriptor definition for testContactInfo has super-type contactInfo but no sub-type attribute. 

我在做什麼錯在這裏?我已將定義保留在userProfile.xml中

+0

如果您的問題得到解答,請註明正確的答案。如果沒有,請進一步詢問 – Vihung

回答

1

第一個問題:您是否確實希望創建contactInfo項目描述符的子類型 - 也就是說,您是否期望系統中的某些項目具有contactInfo類型,一些類型爲testContactInfo的項目 - 或者您只是想將自定義屬性添加到現有的contactInfo項目描述符中?

如果您實際嘗試創建contactInfo的子類型,那麼您需要修改contactInfo的描述符以告訴它如何區分contactInfo類型的項目和testContactInfo類型的項目。您需要添加屬性,說contactType,以CONTACTINFO並設置亞型-property屬性

<item-descriptor name="contactInfo" sub-type-property="contactType" ...> 
    ... 
    <property name="contactType" data-type="enumerated"> 
    <option value="standard"/> 
    <option value="test"/> 
    </property> 
    ... 
</item-descriptor> 

,然後你可以亞型它

<item-descriptor name="testContactInfo" super-type="contactInfo" sub-type-value="test"> 
    ... 
</item-descriptor> 

但是,如果你只是尋找爲其添加定製屬性,您可以很好地添加到現有的定義。您不需要子類型來擴展開箱即用的項目。例如

<item-descriptor name="contactInfo"> 
    <table name="test_contact_info" type="auxiliary" id-column-name="contact_id" shared-table-sequence="1"> 
    <property name="fixedlinenumber" column-name="fixed_line_num" data-type="string"/> 
    </table> 
</item-descriptor> 

將導致名爲fixedlinenumber的新屬性添加到標準contactInfo項目中。

0

項目描述符繼承可以通過兩種方式完成。您可以: -

  1. 爲現有的項目描述符添加新屬性。 在這裏,您可以將許多屬性添加到現有的項目描述符。這可以是開箱即用的,也可以是您的自定義存儲庫。

例如,您可以具有contactInfo項目描述符的employeeId屬性,該屬性可用於所有contactInfo項目。

  1. 創建項目描述符的子類型。 這通常用於具有特定項目描述符的獨特屬性。

例如,在您的contactInfo類型中,您可以有一個「employeeContactInfo」,其中您要存儲額外的員工ID,並且只能爲此類型設置「employeeId」。

所以,它基本上取決於您的要求。你可以看到一些細節,這個網站上..很好的教程: -

http://learnoracleatg.blogspot.in/2014/11/art203-how-to-extend-out-of-box-non.htmlhttp://learnoracleatg.blogspot.in/2014/12/art204-how-to-add-new-item-descriptor.html