SAP Hybris - 建模



Hybris 的主要功能之一是靈活地向全球 Hybris 商務資料模型新增新物件。Hybris 資料建模幫助組織維護其資料庫,並幫助管理資料庫連線和查詢。Hybris 型別系統用於設計 Hybris 中的資料建模。

Hybris 型別系統支援以下資料建模型別:

  • items.xml − 此檔案用於在 Hybris 商務資料模型中進行資料建模。

  • 專案型別 − 用於建立表。

  • 關係型別 − 用於建立表之間的關係。

  • 原子型別 − 用於建立各種原子型別。

  • 集合型別 − 用於建立集合。

  • 對映型別 − 用於定義對映。

  • 列舉型別 − 用於定義列舉。

現在讓我們詳細討論所有這些。

原子型別

這些在 Hybris 中定義為基本型別,包括 Java 數字和字串物件 – java.lang.integer, java.lang.booleanjava.lang.string

<atomictypes>
   <atomictype class = "java.lang.Object" autocreate = "true" generate = "false" />
   <atomictype class = "java.lang.Boolean" extends = "java.lang.Object" autocreate = "true" generate = "false" />
   <atomictype class = "java.lang.Double" extends = "java.lang.Number" autocreate = "true" generate = "false" />
   <atomictype class = "java.lang.String" extends = "java.lang.Object" autocreate = "true" generate = "false" />
</atomictypes>

專案型別

專案型別用於建立新表或更新現有表。這被認為是 Hybris 型別系統的基礎。所有新的表結構都是使用不同的屬性在此型別上配置的,如下所示:

<itemtype code = "Customer" extends = "User" 
   jaloclass = "de.hybris/platform.jalo.user.Customer" autocreate = "true" generate = "true">
   <attributes>
      <attribute autocreate = "true" qualifier = "customerID" type = "java.lang.String">
         <modifiers read = "true" write = "true" search = "true" optional = "true"/>
         <persistence type = "property"/>
      </attribute>   
   </attributes>
</itemtype>

關係型別

此型別用於建立表之間的連結。例如 - 可以連結國家和地區。

<relation code = "Country2RegionRelation" generate = "true" localized = "false" 
   autocreate = "true">
   
   <sourceElement type = "Country" qualifier = "country" cardinality = "one">
      <modifiers read = "true" write = "true" search = "true" optional = "false" unique = "true"/>
   </sourceElement>
   
   <targetElement type = "Region" qualifier = "regions" cardinality = "many">
      <modifiers read = "true" write = "true" search = "true" partof = "true"/>
   </targetElement>
</relation>

列舉型別

這些用於在 Java 中構建列舉,以準備一組特定的值。例如 - 一年中的月份。

<enumtype code = "CreditCardType" autocreate = "true" generate = "true">
   <value code = "amex"/>
   <value code = "visa"/>
   <value code = "master"/>
   <value code = "diners"/>
</enumtype>

集合型別

這些用於構建元素型別的集合/組 - 產品組等。

<collectiontype code = "ProductCollection" elementtype = "Product" autocreate = "true" generate = "true"/>
<collectiontype code = "LanguageList" elementtype = "Langauage" autocreate = "true" generate = "true"/>
<collectiontype code = "LanguageSet" elementtype = "Langauage" autocreate = "true" generate = "true"/>

對映型別

對映型別用於在 Hybris 資料建模中儲存鍵值對。每個鍵代表其自己的程式碼。

<maptype code = "localized:java.lang.String" argumenttype = "Language" 
   returntype = "java.lang.String" autocreate = "true" generate = "false"/>
廣告
© . All rights reserved.