Red Hat Training

A Red Hat training course is available for Red Hat Decision Manager

第2章 データオブジェクト

データオブジェクトは、作成するルールアセットの構成要素です。データオブジェクトは、プロジェクトで指定したパッケージに Java オブジェクトして実装されているカスタムのデータ型です。たとえば、データフィールド NameAddress、および Date of Birth を使用して Person オブジェクトを作成し、ローン申し込みルールに詳細な個人情報を指定できます。このカスタムのデータ型は、アセットとディシジョンサービスがどのデータに基づいているかを指定します。

以下の図は、本チュートリアルで作成する Violation (違反) および Driver (運転者) データオブジェクトを示しています。

図2.1 Driver department traffic violations データオブジェクト

data model

2.1. Violation データオブジェクトの作成

Violation データオブジェクトには、Violation Date (違反日)、Fine Amount (罰金額)、Speed Limit (制限速度) など、違反の詳細を基にしたデータフィールドが含まれます。

前提条件

Driver department traffic violations プロジェクトが作成されている必要があります。

手順

  1. Decision Central にログインします。 MenuDesignProjects をクリックした後、Driver department traffic violations をクリックします。
  2. Create New AssetData Object をクリックします。
  3. Create new Data Object ウィザードで以下の値を入力します。

    • Data Object: Violation
    • Package: com.myteam.driverdepartmenttrafficviolations を選択
  4. OK をクリックします。

    図2.2 Create new Data Object ウインドウ

    data object

2.1.1. Violation データオブジェクトのデータフィールドの追加

前提条件

Violation データオブジェクトが作成されている必要があります。

手順

Violation データオブジェクトのデータフィールドは、後で violation (違反) のルールを定義するときに選択できる制約を定義します。

  1. Violation-general properties セクションの Label プロパティーで Violation と入力します。

    図2.3 General properties

    gen props
  2. + add field をクリックします。
  3. 以下の値を入力します。

    • Id: code
    • Label: Code
    • Type: String
  4. Create and continue をクリックした後、以下の値を入力します。

    • Id: points
    • Label: Points
    • Type: Integer
  5. Create and continue をクリックした後、以下の値を入力します。

    • Id: violationDate
    • Label: Violation Date
    • Type: Date
  6. Create and continue をクリックした後、以下の値を入力します。

    • Id: type
    • Label: Type
    • Type: String
  7. Create and continue をクリックした後、以下の値を入力します。

    • Id: fineAmount
    • Label: Fine Amount
    • Type: Double
  8. Create and continue をクリックした後、以下の値を入力します。

    • Id: speedLimit
    • Label: Speed Limit
    • Type: Integer
  9. Create and continue をクリックした後、以下の値を入力します。

    • Id: actualSpeed
    • Label: Actual Speed
    • Type: Integer
  10. Create をクリックします。
  11. Save をクリックした後、Save をクリックして変更を確認します。
  12. Driver department traffic violations ラベルをクリックして、プロジェクトの Assets ビューに戻ります。

    図2.4 Violation データオブジェクトフィールド

    violation data fields

2.2. Driver データオブジェクトの作成

Driver データオブジェクトには、Name (名前)、Age (年齢)、Total Points (点数の合計) など、運転者の詳細を基にしたデータフィールドが含まれます。

前提条件

Driver department traffic violations プロジェクトが作成されている必要があります。

手順

  1. Decision Central にログインします。 MenuDesignProjects をクリックした後、Driver department traffic violations をクリックします。
  2. Create New AssetData Object をクリックします。
  3. Create new Data Object ウィザードで以下の値を入力します。

    • Data Object: Driver
    • Package: com.myteam.driverdepartmenttrafficviolations を選択
  4. OK をクリックします。

    図2.5 Create new Data Object ウインドウ

    data object2

2.2.1. Driver データオブジェクトのデータフィールドの追加

前提条件

Driver データオブジェクトが作成されている必要があります。

手順

Driver データオブジェクトのデータフィールドは、後で violation (違反) のルールを定義するときに選択できる運転者の詳細を定義します。

  1. 'Driver'- general properties セクションの Label プロパティーで Driver と入力します。
  2. + add field をクリックします。
  3. 以下の値を入力します。

    • Id: name
    • Label: Full Name
    • Type: String
  4. Create and continue をクリックした後、以下の値を入力します。

    • Id: age
    • Label: Age
    • Type: Integer
  5. Create and continue をクリックした後、以下の値を入力します。

    • Id: state
    • Label: State
    • Type: String
  6. Create and continue をクリックした後、以下の値を入力します。

    • Id: city
    • Label: City
    • Type: String
  7. Create and continue をクリックした後、以下の値を入力します。

    • Id: violations
    • Label: Violations
    • Type: Violation(com.myteam.driverdepartmenttrafficviolations.Violation)
    • List: このチェックボックスを選択すると、このフィールドで、指定した型のアイテムを複数保持できるようになります。
  8. Create and continue をクリックした後、以下の値を入力します。

    • Id: fineAmount
    • Label: Fine Amount
    • Type: Double
  9. Create and continue をクリックした後、以下の値を入力します。

    • Id: totalPoints
    • Label: Total Points
    • Type: Integer
  10. Create and continue をクリックした後、以下の値を入力します。

    • Id: reason
    • Label: Reason
    • Type: String
  11. Create をクリックします。
  12. Save をクリックした後、Save をクリックして変更を確認します。
  13. Driver department traffic violations ラベルをクリックして、プロジェクトの Assets ビューに戻ります。

    図2.6 Driver データオブジェクトフィールド

    driver data fields