Formula in a database row - Java

Go To


Either this requirement is weird or i should be confusing myself too much I have a rule table with 30 columns. Every row from a feed file is compared against some or all conditions based on the type of feed. The domain is banking and the application is for loan reporting (say, reporting the amount of total secured loans and unsecured loans)

This is my problem :

If the (total of collateral amount)> loan principal amount, then consider the principal amount for consolidation

Else if the (total of collateral amount)<loan principal amount, then consider only the amount covered by collateral

I have some 5 scenarios like this (which should be customizable) by users (say, if the collateral is cash/equities, then consider only cash collateral/equity collateral).

POssibly more of this scenario is expected. I am not sure how i should approach this problem. My plan is to create a column in the rule table and have some preformatted simple english conditions in them (document and teach users of this), parse them using Regex and convert it into numbers later. I have no knowledge/experience with DSL and this is the best??!! what i can think of. Any help will be a great source of knowledge to me. Thanks. Arun

2009-06-16 08:24
by NoName


You can use business rules engine to implement this instead of implementing your own parsing logic or writing a DSL.

Refer to Business Rules Engine for details. Most rule engines will allow you to create a grammar in plain english to define such rules. We use ilog JRULES for defining such rules. There are several other commercial and open source rules engines available. One popular open source software is drools.

2009-06-16 08:28
by Rahul