I have a situation where Orders in my system have a many-to-one relationship with an entity called "OrderGroup" that represents a "one-time" or "recurring" status of the child orders, and other fields related to that (interval for recurrence, etc, it's basically like a subscription.) So, the relationship simplified, looks like this:
Code: Select all
Customer 1--* Order *--1 OrderGroup ---*
|______________________________________|
1
Furthermore, there is a Timestamp on Order called FulfillmentDate that represents if an Order has been fulfilled. There is only ever one unfulfilled Order in an OrderGroup if the OrderGroup is "recurring".
I am tasked with showing on the Customer entity screen, two grids of orders, one called "Orders" of which is all Orders where the fulfillmentDate is not null, and another called "Subscriptions" where the fulfillmentDate is null and its associated OrderGroup.status is "recurring".
What is the "BroadLeaf way" to implement this? Currently the path I have taken is:
1. I have created two views that represent each subset of data, FULFILLED_ORDER and UNFULFILLED_RECURRING_ORDER; each table has only the customer_id and order_id.
2. I have created entity classes for each of these views that extend OrderImpl
3. Subclassed CustomerImpl to have JPA-annotated one-to-many association to these entities.
It pretty-close-to-works. Customers on the admin interface show my new tables of data. choosing to view one of the records brings up the modal window, and lets me edit and save. However, I cannot delete or add new because the action occurs on the view.
So to reiterate my question, did I proceed the "right" way? And how best to continue to fully implement this?
I am using Broadleaf 3.0. Also thank you for the fantastic work.