Databases Reference
In-Depth Information
The rule editor allows us to choose from the following action types:
assert new : We use this to create and assert a new fact, for example, a new
LeaveRequest . Once asserted, the new fact will be evaluated by the rules
engine against the ruleset.
modify : We can use this to either assign a value to a variable or a fact
attribute; in our case we want to assign a status of Approved to the
requestStatus property.
retract : This enables you to retract any of the facts matched in the pattern
(for example, TLeaveRequest ) so that it will no longer be evaluated as part
of the ruleset.
call : This allows you to call a function to perform one or more actions.
The actions assert new and retract are important when we are dealing with rulesets
that deal with multiple interdependent facts, as this allows us to control which
facts are being evaluated by the rule engine at any particular time. Here, we are
only dealing with a single fact, so we don't examine these constructs in this chapter,
leaving them to Chapter 18 , Using Business Rules to Implement Services .
For our purposes, we want to update the status of our leave, so select modify . Our
rule should now look as shown in the following screenshot:
The next step is to specify the fact to be modified. Click on the <target> element and
you will be presented with a list of facts that are within scope. In our case, this will
only be the TLeaveRequest that has just been matched by the IF clause, so select
this. Our rule will now appear, as shown in the following screenshot:
 
Search WWH ::




Custom Search