Describes a web application with dynamic interaction logic.
Dynamic Web Application "LoanDynamics"
This web application supports dynamic business loan approval scenarios like this one:
Events and Facts Loan Application Decision Comments Peter Johnson applied for $50K loan Rejected Insufficient Income. But a loan officer noticed that they have a valuable client with the same address Joe & Dawn Johnson agreed to be Peter's guarantors. They have a Housing Loan with Available Equity of $300K and Remaining Debt of $150K Accepted $100K surplus is a sound proposition. But conducting more detailed analysis, the officer noticed a joint borrowing on Mt. Johnson's file which is not with his wife Joe Johnson and his partner Bill Smith (50/50) have a Business Loan for $200K with Available equity of $52K Accepted The remaining $26K surplus still meets requirements. But Bill and Susan Smith have other facilities outstanding against their property as well as the business loan Bill & Susan Smith have a Housing Loan with Available Equity of $240K and Remaining Debt of $150K Accepted Still a surplus. But a lending clerk noticed a secured personal loan in the name of Tommy Smith for $50K secured by his parents Their son Tommy Smith has $50K loan secured by his parents Rejected Accumulated remaining equity is less than the requested loan amount. The initial debt to Peter Johnson would be $8.8K short on cover
The following screens represent different interaction steps for the above scenario. They are created using OpenRules Web Forms.
Step 1. Entering Borrower Personal Data
After validating SSN correctness, the button "Next" moves a dialog to the next interaction step.
Step 2. Entering Loan Request Information
This step validates the requested loan amount for min/max limits, and checks such conditions as "Loan term cannot be more than 36 months for amount < $5,000".
Step 3. Entering Related Facts (securities that may affect accept/reject decision)
Initially there could be no related facts/securities. By clicking "Add Security", you can add new rows to this table and enter the related information. Buttons "Del" allow to delete previously entered securities. Securities have a flag "Active" allowing to include or exclude them from the total loan evaluation process. The button "Next" executes the rule engine "validateIncomeWithEquities" that recalculates the total equity and total remaining debt using ALL related securities and then it makes an Accept/Decline decision.
Step 4. Displaying Rule Engine Results with Explanations
By clicking "Prev", a user can go back and make changes in the loan amount or related securities.
Presentation Logic. Here is a list of four interaction steps and rules that should be executed before displaying the proper screens:
All screens (interaction steps) above are defined as Layout tables in Excel. Please note that before generating the Results view, we direct system to execute business rules presented in the rules table "validateIncomeWithEquities". The interaction logic that specifies which processing steps should be executed upon which events is presented in the following rules table ("state machine"):
In particular, it defines that if a user clicks to the button "Next" on the last screen "Results", it would be taken to the first screen "BorrowerData". By clicking "Prev", a user always can go back to the "Securities" view to add/remove related securities.
Here are the screen layouts themselves that can be easily associated with their actual web views above.
Here we are using a standard input validator "validateSSN" that will generate an error message if the entered SSN does not have a valid format.
Here we are using two custom input validators:
1) "validateLoanAmount" that will generate an error message if the entered Loan Amount violates min/max limits
2) "validateLoanTerm" that will generate an error message if Loan Term is larger than 36 months while Loan Amount is less that $5,000. Here are Excel tables, in which we defined these validators:
This layout can be dynamically changed: a user can add/delete rows in the table of securities. So, we will build this dynamic layout "on the fly" using the method "securityTableContent":
This method takes a fixed layout "securityTableHeader"
and attaches (merges) to it all security rows known by that moment and saved in the object SecurityList. Each row is formed based on the following layout:
The buttons that allow a user to add or delete securities are defined in the following methods:
All these layouts in different moments (defined by the processing flow rules above) play role of the current layout if the following generic layout:
And finally, the main of the LoanDynamics application that will be executed on every client-server interaction presented in this Excel table:
Business Logic. Business rules used in this application should evaluate borrower's income and debt with respect to all related securities. We will use simple formulas that calculate the total equity and total remaining debt to makes an Accept/Reject decision. The proper rules and formulas are presented in the following Excel tables:
Business Object Model. To represent a business object model for this application we use 4 simple Java classes:
Class Properties and Methods
|Borrower (Java bean)||String fullName;
|LoanApplication (Java bean)||Borrower borrower;
|Security (Java bean)||String id;
(inherited from java.util.ArrayList)
|Maintains a list of
More examples of dynamic interaction scenarios are described here.