Sometimes the data in your database may not obey the rules you have defined in your logic classes. There could be several reasons for this:
Regardless of why, you need to be able to detect this situation, and to fix it. ABL provides the recompute utility for this purpose.
Recompute is available as a separate package. You can download it from the current download page.
Recompute has dependencies that are essentially the same as any ABL application:
Before running Recompute, you'll need to make sure that your Java class path includes the required libraries (as listed above), as well as the JDBC driver(s), your logic classes, and your bean classes (if relevant).
Recompute can run in one of three modes:
The Recompute utility will write a report file outlining what it has found out and/or what it has done. The only time it will not write a report file is if has not found any errors.
In scan mode, you will almost always want to use the xml output format. The report will outline what errors have been found, along with a sample of the incorrect data (up to 100 rows per error).
A sample XSL stylesheet is provided to format this XML report into an HTML page. You can use it in an Ant script as follows:
In plan mode, you will typically use either the xml output format or the sql output format. The sql output format shows what HQL statements would have to be run in order to fix the data.
In fix mode, you will also use either the xml output format or the sql output format.
If you prefer to have your own formatting for the report, you can create a class that implements the
There are two special annotations that will influence the execution of recompute.
Formulas can be skipped during recompute with the following parameter:
By default, formulas are not skipped during recompute. If you need a formula to be skipped, you need to specify the
Actions (including EarlyActions and CommitActions) are normally not invoked during recompute. You can change this behavior with the following:
Note that actions will be invoked only in fix mode. This is because actions can often affect the state of the database, or of some other system, and that's of course desirable only if you really mean to fix the data.
When the recompute utility executes, it can notify a listener class of its progress, and the listener can also affect how the utility executes.
To create a recompute listener, you need to implement the
Once you have a recompute listener class, you can specify it to the recompute utility by using the parameter appropriate for your invocation method.