2.2. Driver データオブジェクトの作成
Driver データオブジェクトには、ドライバーの Name、Age、Total Points など、ドライバーの詳細に基づくデータフィールドを含めます。
前提条件
Driver_department_traffic_violations プロジェクトを作成した。
手順
-
Menu
Design Projects Driver_department_traffic_violations に移動します。 -
Add Asset
Data Object をクリックします。 Create new Data Object ウィザードで以下の値を入力します。
-
Data Object:
Driver -
Package:
com.myspace.driver_department_traffic_violationsを選択します。
-
Data Object:
Ok をクリックします。
図2.4 新規データオブジェクトの作成ウィンドウ
2.2.1. Driver データオブジェクトの制約の追加 リンクのコピーリンクがクリップボードにコピーされました!
Driver データオブジェクトのフィールドに、ルールを定義するときに選択する制約を入力します。
前提条件
Driver データオブジェクトを作成した。
手順
-
'Driver'-general propertiesセクションで、Label フィールドに Driver と入力します。 - + add field をクリックします。
以下の値を設定します。
-
Id:
name -
Label:
Full Name -
Type:
String
-
Id:
Create and continue をクリックしてから、以下の値を入力します。
-
Id:
age -
Label:
Age -
Type:
Integer
-
Id:
Create and continue をクリックしてから、以下の値を入力します。
-
Id:
state -
Label:
State -
Type:
String
-
Id:
Create and continue をクリックしてから、以下の値を入力します。
-
Id:
city -
Label:
City -
Type:
String
-
Id:
Create and continue をクリックしてから、以下の値を入力します。
-
Id:
violations -
Label:
Violations -
Type:
Violation(com.myspace.driver_department_traffic_violations.Violation) - List: このチェックボックスを選択すると、このフィールドで、指定したタイプのアイテムを複数保持できるようになります。
-
Id:
Create and continue をクリックしてから、以下の値を入力します。
-
Id:
fineAmount -
Label:
Fine Amount -
Type:
Double
-
Id:
Create and continue をクリックしてから、以下の値を入力します。
-
Id:
totalPoints -
Label:
Total Points -
Type:
Integer
-
Id:
Create and continue をクリックしてから、以下の値を入力します。
-
Id:
reason -
Label:
Reason -
Type:
String
-
Id:
- Create をクリックします。
- Save をクリックした後、Save をクリックして変更を確認します。
Driver_department_traffic_violations ラベルをクリックして、プロジェクトの Assets ビューに戻ります。
図2.5 Driver データオブジェクトのフィールド