Should I use a reporting structure?

To clarify what I'm trying to do, take a classic banking example.

I have a stream of payments coming from one bank account to another. I would like users of my web application to be able to create their own predicates for filtering payments, which will form input into some reports. I planned to write reports manually, and not with the existing reporting structure.

In order of priority, the types of predicates that I would like users to be able to create using the web interface are as follows:

  • payment.amount > 100.0
  • payment.amount > 100.0 || payment.dayOfWeek = TUESDAY
  • (payment.amount > 100.0 && payment.description.contains("foo")) || payment.dayOfWeek = TUESDAY

I would also like to keep these predicates for reuse later.

I believe that this should be such a general requirement that at least part of this must have already been developed, but it’s hard for me to determine what exactly I'm trying to find on Google. Does anyone come across a web framework for generating predicates and / or something else to store this data?

+4
source share
2 answers

I think you can use Drools to create and reuse business rules.

+2
source

A business rule engine may be a good solution, but it can also be negative.

There are many rules on the market, and they are very different. For example, http://openrules.com is highly severe when drooling is more of a development tool for developers (see http://java-source.net/open-source/rule-engines for a large list of engines).

Even embedding a scripting language such as groovy might be a good solution.

Bit, if you really need only the three rules that you have described, I think it would be wise to just save these three parameters (quantity, searchTerm and working day) and build a database query with them.

0
source

Source: https://habr.com/ru/post/1400211/


All Articles