You use Rule Designer to run this sample.
Make sure that you are in the Rule perspective before running this sample.
To run this sample:
This runs the sample with the XOM made of generic objects.
type CashEvent accountID=AC1 amount=-120.0 parentID=null type=DEBIT
currency=EUR ...
This format is the one implemented in the toString() method of the generic objects.
The project rebuilds automatically.
This time, the sample runs with the XOM made of Java™ regular objects.
Type: DEBIT Date:...
This format is the one implemented in the toString() method of the financialevent xom objects.
If you have multiple consoles, you can switch between the two traces and compare the execution results.
The project rebuilds automatically.
You see that the XOM code called in each run is different.
The Java XOM is defined in financialevent-xom. The whole model uses interfaces and implementation classes. The interfaces are imported to create the BOM.
The generic XOM is defined in bom2xom-generic-xom. It consists of three classes:
The generic XOM is completed by an adapter XOM, called bom2xom-extenderxom, which is specific to this sample and is defined in the bom2xom-extenderxom project. This provides an extender class for one of the BOM classes, and a model.properties that models the extension relationship between CashEvent and FinancialEvent classes.
As a generic object model does not support behavioral methods (that is, methods other than accessors and mutators), these methods are implemented with one of the following:
As the Java XOM uses constructors to create objects, and the generic XOM requires the GenericObjectHelper 'static factory' to create objects, the choice is to create static BOM 'create' methods on each BOM class. These methods are translated into calls to the appropriate constructors in the case of the Java XOM, and into calls to the GenericObjectHelper.create(String type) static method in the case of the generic XOM.
For simplicity, both configurations use utility classes for currency and date management that belong to the financialevent-xom XOM project. But these can be different.