Creating the Rules
Procedure
-
In the Project Explorer view, expand the buyerrules node and the Rules Modeling node and choose New Rule in the context menu of the discountrules node.
-
In the dialog box that appears, enter AnyBuyer in the field and choose OK .
You should see the AnyBuyer node in the Outline view.
Repeat the steps to create two more rules: BigBuyer and NoCreditBuyer .
In the Outline view you should see the rule nodes.
-
Save the changes.
Editing AnyBuyer rule
-
In the Outline view, choose the AnyBuyer node.
-
In the rule editor that appears, under the If section, choose Add .
The default condition: Operation.isSuccessful Equals true appears.
-
Edit the default condition as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersname .
-
Leave the comparator: Equals as it is.
-
Choose the RHS value: Default Value and enter * in the inline text box.
-
-
Add another condition and edit as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersspendinghabit .
-
Leave the comparator: Equals as it is.
-
Choose the RHS value: Default Value and enter * in the inline text box .
-
-
Add one more condition and edit as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyerscredit .
-
Leave the comparator : Equals as it is.
-
Choose the RHS value: Default Value and enter * in the inline text box .
-
-
Under the Then section, choose the Add icon and in the drop down menu that appears, choose Execute .
-
Choose < Action Method > and in the drop down menu, choose Buyer.setSetdiscount ( {double} ) .
-
Choose {(double)} and in the inline text enter the value : 10
-
Save the changes.
Editing BigBuyer rule
-
In the Outline view, choose the BigBuyer node.
-
In the rule editor that appears, under the If section, choose the Add icon.
The default condition: Operation.isSuccessful Equals true appears.
-
Edit the default condition as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersname .
-
Leave the comparator: Equals as it is.
-
Choose the RHS value: Default Value and enter * in the inline text box .
-
-
Add another condition and edit as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersspendinghabit .
-
Leave the comparator: Equals as it is.
-
Choose the RHS value: Default Value and enter good in the inline text box .
-
-
Add one more condition and edit as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyerscredit .
-
Leave the comparator : Equals as it is.
-
Choose the RHS value: Default Value and enter good in the inline text box .
-
-
Under the Then section, choose the Add icon and in the drop down menu that appears, choose Execute .
-
Choose < Action Method > and in the drop down menu, choose Buyer.setSetdiscount ( {double} ) .
-
Choose {(double)} and in the inline text enter the value : 20
-
Save the changes.
Editing NoCreditBuyer rule
-
In the Outline view, choose the NoCreditBuyer node.
-
In the rule editor that appears, under the If section, choose the Add icon.
The default condition: Operation.isSuccessful Equals true appears.
-
Edit the default condition as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersname .
-
Leave the comparator: Equals as it is.
-
Choose the RHS value: Default Value and enter * in the inline text box.
-
-
Add another condition and edit as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersspendinghabit .
-
Leave the comparator: Equals as it is.
-
Choose the RHS value: Default Value and enter * in the inline text box.
-
-
Add one more condition and edit as follows:
-
Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyerscredit .
-
Leave the comparator : Equals as it is.
-
Choose the RHS value: Default Value and enter bad in the inline text box .
-
-
Under the Then section, choose the Add icon and in the drop down menu that appears, choose Execute .
-
Choose < Action Method > and in the drop down menu, choose Buyer.setSetdiscount ( {double} ) .
-
Choose {(double)} and in the inline text enter the value : 0
-
Save the changes
Next Step