I have combined all of your work on Phase .2 and have redone some of it to make it more internally consistent and correct. Here is a zip file with my sources as well as a Kawa project and a Codewarrior project.
USING the new System.
The new database is the file opdb.dat. It currently has Customers C5001 thru C5004, Products P2001 thru P2004 and Inventory records for those products except that there is none for P2003. There are several main functions in this system. One in each file that has Generator or Maintenance as the suffix of the file name. To run one of these "functions" you prepare a suitable input file (each has its own format requirements) and run the java interpreter using that file.
java orderprocessing.CustomerMaintenance customermaint.txt
java orderprocessing.ProductMaintenance productmaint.txt
java orderprocessing.InventoryMaintenance inventorymaint.txt
java orderprocessing.OrderGenerator orders.txt
Each of these will open the "database," make updates, and then close the database, saving all changes. (Actually, InvoiceGenerator is just a skeleton now.)
There is a special feature. If you execute OrderProcessor as an application with
then the database will be reinitialized to empty. You can then rebuild it up from your transaction (data) files by doing the following (IN THIS ORDER)
Run the CustomerMaintenance module with your customer creation
Run the ProductMaintenance module with your product creation entries
Run the InventoryMaintenance module with your inventory insertion entries
Once you do this you have a live database. Treat it with respect. Don't run the same transaction file against it twice or you will have duplicate records (perhaps with different keys.) For example, the same customer with two different customer numbers. To guard against problems you can make a backup copy of the database file before you run a set of transactions so that roll back is just discarding the new version and restoring the copy. You can change the classes while keeping the data intact by using the versioning method discussed when we last met. I've made all the necessary files versionable.
You can now run orders for these customer/product/inventory combinations.
After running orders you can run invoices.
Running these will, of course, update the database file as well.
NOTE. Not all features have been tested. I accepted some of your input code without checking it. I didn't have time to do extensive checking. The small transaction files stored here is all I have tested. BEWARE.
NOTE. All of the programs can be run with output redirection to catch the resulting report files. For example
java orderprocessing.CustomerMaintenance custrans.dat >customerreport.txt
You will also notice a difference in programming style in these files. This is unfortunate, but I didn't have time to make it uniform. As a general rule you will find life easier if you rigidly adopt a programming style that lines up braces, parentheses, etc. precisely vertically or precisely horizontally. Look at my original files for an example of this. This style is much easier to read than hiding the opening brace on the end of one line and the closing brace at the beginning of some later line.
I have also provided a batch file init.bat which will zero out the database
and then reload it from the files (in this order)
This batch file can be used to restore the database from the original transactions, assuming they are available, to avoid the complications of versioning when the database contains only test data.