

Application business logic in Aware IM is governed by business rules. A business rule specifies one or more actions that should be executed when the rule conditions are met. The conditions are optional and if none are given the actions are executed unconditionally. In other words a rule states what should happen and when.
Here are some examples of rules:
If AGE (Order.Customer.DateOfBirth) < 18 Then REPORT ERROR 'Orders cannot be placed by customers under 18 years old'
Order.TotalAmount = Order.NetAmount + Order.Tax
Order.NetAmount = SUM LineItem.Amount WHERE LineItem IN Order.Items
If Order.Status WAS CHANGED TO 'Submitted' Then SEND OrderConfirmationEmail TO Order.Customer
If Order.Status='Submitted' Then PROTECT Order FROM Customer
Unlike scripting languages, Aware IM business rules are written in a high-level language that does not have technical elements like variables, structures, arrays or loops. Business rules are expressed in business terms, like in the above examples, rather than in a mixture of business and technical terms. The absence of technical details makes business rules compact and easy to understand.
Each business rule is attached to a particular business object (such as Order in the above examples) and is independent of other rules. A business rule is a self-contained piece of business logic that should fully describe actions to be taken under specified conditions.
Once you have determined the rules that should govern your application, you attach each of your business rules to a relevant object. Aware IM automatically executes business rules when records are changed. You do not need to keep in mind all possible scenarios that may cause a change and write a separate script for every scenario. Each business rule needs to be entered only once, there is no duplication of portions of your business logic in different places.
Aware IM automatically considers all relevant business rules when it detects a change in the data that a rule refers to. It then executes the actions of those rules the conditions of which are satisfied. Data changes can be caused by various reasons, like the users creating or changing records via data forms (a typical situation), arrival of an incoming e-mail, execution of a scheduled periodic process, and others.
In addition to considering rules attached directly to the changed object, Aware IM also uses the knowledge of relationships between objects to see if rules for a particular object depend on changed data in related objects. For example, if the Amount field in a Line Item record is changed, Aware IM will automatically find in the database the Order record to which the Line Item belongs and execute the rules for the Order so that Net Amount of the Order is re-calculated.
If an executed action causes further data changes, Aware IM will re-examine all the affected rules, including those of related objects, and execute their actions if necessary. It will repeat the cycle until no more changes are detected. Therefore, an initial change may result in a number of further changes that Aware IM will automatically carry out to maintain data consistency according to the specified rules.