Java Reference
In-Depth Information
13.4 Optimistic offline locking
with detached objects example
In this section, we will look at a Domain Model pattern-based design for the
Acknowledge Order use case that implements the Optimistic Offline Lock pattern
using detached objects. At the start of the use case, the business logic detaches the
order that is being acknowledged and hands it back to the presentation tier.
When the user acknowledges or rejects the order, the presentation tier updates
the order and passes it back to the presentation tier, which reattaches it.
The design, which is shown in figure 13.3, consists of several classes, including
AcknowledgeOrderService , Order , and OrderRepository .
Presentation
Tier
Spring TransactionInterceptor
<<interface>>
AcknowledgeOrderService
AcknowledgeOrderResult getOrderToAcknowledge(orderId)
AcknowledgeOrderResult acknowledgeOrder(order)
Acknowledge
OrderResult
AcknowledgeOrderServiceImpl
statusCode
AcknowledgeOrderResult getOrderToAcknowledge(orderId)
AcknowledgeOrderResult acknowledgeOrder(order)
Order
<<interface>>
OrderRepository
<<interface>>
OrderAttachmentManager
accept(notes)
reject(notes)
Order findOrder()
Order detach(Order)
Order attach(Order)
Figure 13.3
Domain Model pattern-based design for the Acknowledge Order use case
 
 
Search WWH ::




Custom Search