polymorphic mapping (brutos mvc)

Download Polymorphic mapping (Brutos mvc)

Post on 17-Aug-2015

42 views

Category:

Technology

0 download

Embed Size (px)

TRANSCRIPT

  1. 1. Polymorphic mappingPolymorphic mapping Brutos MVCBrutos MVC www.brutosframework.com.brwww.brutosframework.com.br
  2. 2. Polymorphic mappingPolymorphic mapping The polymorphic mapping, introduced in release 2.0, is a solution of such mapping requirement as an instance of entity needs to be associated with one of multiple possible entities. This can be implemented with the annotation @Any. This mapping type requires that besides the mapping of beans, is informed the meta-bean, a variable that contains the identifier associated with the bean. One such real life example is sale scenario, where a touristic operator seller different services. The requirement is to design sales system to manage the data of services being sold. The system allow registry one air or hosting service per sale transaction.
  3. 3. Polymorphic mappingPolymorphic mapping In this case, during each sale transaction, one service will be sold. This service can either be air or hosting.
  4. 4. Polymorphic mappingPolymorphic mapping SaleTransaction.java The annotation @Any indicates that service property may receive the instances of AirService, if parameter entity.service.serviceType is equals to "air", or HostingServices, if parameter entity.service.serviceType is equals to "hosting". The annotation @Transient indicates that property is ignored by the framework.
  5. 5. Polymorphic mappingPolymorphic mapping Service.java
  6. 6. Polymorphic mappingPolymorphic mapping AbstractService.java
  7. 7. Polymorphic mappingPolymorphic mapping AirService.java
  8. 8. Polymorphic mappingPolymorphic mapping HostingService.java
  9. 9. Polymorphic mappingPolymorphic mapping SalesController.java
  10. 10. Polymorphic mappingPolymorphic mapping View (part of serviceType mapping)
  11. 11. Polymorphic mappingPolymorphic mapping View (part of airService mapping)
  12. 12. Polymorphic mappingPolymorphic mapping View (part of hostingService mapping)
  13. 13. ReferencesReferences http://www.brutosframework.com.br/http://www.brutosframework.com.br/ http://www.amazon.com.br/Brutos-Framework-http://www.amazon.com.br/Brutos-Framework- framework-para-aplica%C3%A7%C3%B5es-framework-para-aplica%C3%A7%C3%B5es- ebook/dp/B00VD3JDOM/ref=sr_1_1?ebook/dp/B00VD3JDOM/ref=sr_1_1? ie=UTF8&qid=1435879104&sr=8-ie=UTF8&qid=1435879104&sr=8- 1&keywords=java+mvc1&keywords=java+mvc https://en.wikipedia.org/wiki/Brutos_Frameworkhttps://en.wikipedia.org/wiki/Brutos_Framework