Sap-hybris-modelling

提供:Dev Guides
移動先:案内検索

SAP Hybris-モデリング

Hybrisの主な機能の1つは、グローバルなHybris Commerce Dataモデルに新しいオブジェクトを追加できる柔軟性です。 Hybrisデータモデリングは、組織がデータベースを保守し、データベースの接続とクエリを管理するのに役立ちます。 Hybris Typeシステムは、Hybrisでのデータモデリングの設計に使用されます。

Hybris型システムには、データモデリング用に次の型がサポートされています-

  • Items.xml -このファイルは、Hybris Commerceデータモデルでのデータモデリングに使用されます。
  • アイテムタイプ-これはテーブルを作成するために使用されます。
  • リレーションタイプ-これはテーブル間のリレーションを作成するために使用されます。
  • アトミックタイプ-さまざまなアトミックタイプを作成するために使用されます。
  • コレクションタイプ-コレクションの作成に使用されます。
  • マップタイプ-マップを定義します。
  • 列挙型-列挙型を定義します。

これらすべてを詳細に説明しましょう。

原子タイプ

これらは、Hybrisの基本タイプとして定義され、Java番号と文字列オブジェクト( java.lang.integer、java.lang.boolean または java.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で列挙を構築するために使用されます。 たとえば、1年の月。

<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"/>