< 上一個課程 | 下一個課程 >

作業 5:修訂詞彙

海梁詞組主詞和含有引數之方法的文字化。

關於這項作業

必要的話,您可以編輯預設文字化中的術語或詞組,使其更容易瞭解。您將利用編輯術語對話框,來編輯 BOM 編輯器的類別文字化。您將使用「內容輔助」,在範本欄位中編輯成員文字化,或編輯導覽與動作詞組。如果要編輯詞組中使用的主詞,請使用編輯術語對話框。

在 UnderAge 規則中,您必須進一步闡明下列詞組:
the customer age of the rental agreement
the session .displayMessage ( "...")

the customer age of the rental agreement 詞組可能造成混淆,因為它似乎讓 age 與 rental agreement 相關聯。為了減少語意不明,您可以編輯 customer age 術語,這是詞組的主詞。

程序

  1. 編輯 the customer age of the rental agreement詞組的主詞:
    1. 在「規則瀏覽器」視圖中,按兩下 BOM 項目 model。
    2. 在「大綱」視圖中,展開 RentalAgreement,然後按一下 getCustomerAge 方法。
    3. 在「成員文字化」區段中,按一下編輯詞組所用的主詞。

      這時會開啟「編輯術語」對話框。

    4. 在單數欄位中,將文字變更為 age of the customer,然後按一下確定。

      警告訊息會通知您,這些變更可能影響您的規則。

    5. 在檔案功能表中,按一下儲存。

      這時會開啟「重構詞彙」對話框。

    6. 確定已選取 UnderAge 規則,然後按一下是。
    7. 開啟 UnderAge 規則。

      您已透過新文字化,更新這個規則的條件部分:

      if
      the age of the customer of the rental agreement is less than 18

    依預設,會將含有引數的方法(例如 Session.displayMessage)文字化,但是您必須修改文字化,來闡明其意義:

  2. 編輯 Session.displayMessage 方法的文字化:
    1. 在 Intellirule 編輯器中開啟 UnderAge 規則。
    2. 按住 Ctrl 並按一下 the session .displayMessage ( "The rental agreement is rejected.");(會以鏈結形式出現)。

      這時會開啟「BOM 編輯器」的「成員」頁面。

    3. 在「成員文字化」區段中,刪除動作詞組範本欄位的內容。
    4. 輸入下列動作詞組:
      display the message {0} in {this}

      您可以利用「內容輔助」方框 (Alt+/),將位置保留元 {0} 和 {this},插入至新的動作詞組中。您必須輸入詞組的其餘部分。

      警告訊息會通知您,這些變更可能影響商業規則。

    5. 在檔案功能表中,按一下儲存。

      這時會開啟「重構詞彙」對話框。

    6. 確定已選取 UnderAge 規則,然後按一下是。
    7. 開啟 UnderAge 規則。您可以看到已透過新文字化更新了規則:
      if
         the age of the customer of the rental agreement is less than 18
      then
         make it true that the rental agreement is rejected; 
         display the message "The rental agreement is rejected" in the session;

      如需使用規則編輯器的相關資訊,請參閱使用動作規則。

結果

在下一項作業中,您將擴充 BOM,亦即,建立一個列舉網域,並顯示成商業規則中的清單。

< 上一個課程 | 下一個課程 >