MVC Application

The final building block of the Airline Ticket Booking System MVC application is the data logic part of the Model layer. As was discussed before, the data logic part of the Model layer will be built using entity beans. The session beans in the business logic part of the Model layer will access and use the entity beans to interact with the database (in our case, PointBase). For accessing the data stored in the database tables, you will need to define three entity beans. These are defined based on the nature of data encapsulated by these entity beans.

The data that the entity beans represent can be classified as flight information, passenger information, and ticket information. This data will be used by the session beans in the business logic part of the Model layer to send to the JSPs in the View layer. So, for these three sets of information, you can define three entity beans FlightBean, PassengerBean, and TicketInfoBean.

To cut down development time, the entity beans will use CMP. Also, to improve performance, the entity beans will be colocated with the session beans and hence will use local instead of remote interfaces.

Now take a look at the tables to which these entity beans will map:

  • The FlightBean entity bean is responsible for accessing flight information and retrieves the available flights based on certain search criteria. Hence, the FlightBean will map to the columns in the flight and flight_details tables.

  • The PassengerBean entity bean manages passenger-related information. Hence, the PassengerBean will map to the columns in the passenger_profile and credit_card_details tables.

  • Finally, the TicketInfoBean will encapsulate the passenger's ticket information stored in the ticket_info table.

There is one more layer of isolation that will be built in the MVC application. Because you do not want the entity beans to be passed across layers, you will be extracting the data within the entity beans and wrapping it inside business objects that mirror the entity beans but are just plain Java classes. The session beans will extract the data from the entity beans and populate the respective business objects. The business objects containing the data will then be passed on to the JSPs in the View layer embedded within the MVCAppValueObject. The JSPs will then extract the data from the business objects and format them as required. The three business objects that will be written are FlightDetails, PassengerProfile, and TicketDetails, organized in the com.sams.learnweblogic7.businessobject package.

In order to understand the interaction of the entity beans that form part of the Model layer with the rest of the MVC application, take a look at Figure 13.5, which lists the sequence diagram of the Airline Ticket Booking System MVC application.

Figure 13.5a. Sequence diagram of the Airline Ticket Booking System MVC application showing the Model (entity bean) layer interactions.

graphics/13fig05a.gif

graphics/13fig05b.gif

The entire code of the FlightBean, PassengerBean, and TicketInfoBean entity beans is listed in Appendix C. This includes the listing for the home and local interfaces of these beans.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net