This sample demonstrates a service for calculating Mortgage Insurance Premium (MIP) using business rules.
Prerequisites
To run this sample:
- Windows, Linux or Solaris operating system should exist.
- WSO2 BRS should be installed. To install the BRS, refer Installing the Product. This also includes installing Apache Ant as one of the Installation Prerequisites.
- WSO2 BRS should be started as described in Running the Product.
Sample Configuration
...
Sample Rule Definition
...
Rules
The mortgage insurance rate is 0.5 for MIP insurance and 1.5 for FHA loans.
Facts
There is one fact named Client. The result of the rule execution is Mortgage Insurance Premium.
Code Block | ||
---|---|---|
| ||
package samples.MIPCalculate; /** * Client fact */ public class Client { private String loanType; private double mortgageValue; private double downPayment; public String getLoanType() { return loanType; } public void setLoanType(String loanType) { this.loanType = loanType; } public double getMortgageValue() { return mortgageValue; } public void setMortgageValue(double mortgageValue) { this.mortgageValue = mortgageValue; } public double getDownPayment() { return downPayment; } public void setDownPayment(double downPayment) { this.downPayment = downPayment; } } package samples.MIPCalculate; /** * MIP - Mortgage Insurance Premium */ public class MIP { private double annualMIP; public double getAnnualMIP() { return annualMIP; } public void setAnnualMIP(double annualMIP) { this.annualMIP = annualMIP; } } |
Rule Service Configuration (service.rsl)
An in-line rule set is used within the service.rsl file as follows.
...