After completion of the "Overview of the class in the" In the hotel management system ", I carefully reviewed my definition of each class. I found that I didn't know unconsciously into the category of EJB (Enterprise Javabean), from I in front. The concepts defined in the text can be seen in which the room information, predetermined information, and the rental information belong to the entity bean in EJB (specifically, I should call the bean class in the entity bean), and the management personnel and the hotel service Personnel should be the Bean class in the session bean in EJB (I called a session class here). (Search information is a class that does not explain well, is as before, this class is a problem.) I don't know if someone else will appear in the actual process. The situation is that I feel that the program designer gets this result in the analysis of the design of the design without the EJB. If this is the case, the concept of EJB should appear before Java appears, is it like me? I hope that the reader knows that this is the classification of the object very often about the OO's design process.
And if the situation is really as analyzed, we don't have too much content in the physical class (which may be described in detail after the definition of the database), because the effect of the entity bean is mainly JDBC or Some of the other backend APIs often access data provides an object-oriented interface, that is, the entity class is actually an embodiment of the content of the database in the program. Of course, we may use special processing methods in the process of specific implementation, such as using a field as an object separately. I just given these classes in the following (this thought these content will exist in the form of an interface, so that I have supported the network, I don't want to I don't know how to enter the category of EJB,) a name for use below.
1. Room information: roominfo2, scheduled information: reserveinfo3, rent information: rentinfo
Then we will handle the main features of the main session object of the store waiter and define them into a way homeman (for the administrator's query).
We first named Hostelclerk for the hotel staff, and it is the main part of the HotelClerk class (no implementation for the session bean interface).
Import java.util. *;
/ * * CREATED ON 2003-7-28 * /
/ ** * this class is buy in hostel misplements * room rent, reserving, check out and other main function. * * @Author iDilent * / public class hostelclers {
/ ** * This method is used to get the available rooms when the clerk * reserves or rents room for the custommer. * * @Param roomPrice the price of the room * @param fromDate the date from which the room will be rented * @ param toDate the date to which the room will be rented * @return the available rooms. * * there may be should a class call SearchCondition which encapsulates * the search conditions * * / public RoomInfo [] availableRooms (Currency roomPrice, Date fromDate, Date toDate) {return null;} / ** * This method is used to rent a room, since the availableRooms method had to be * called before this function (else you will have no idea of which room is availble * to rent), so we can get a roomID form the RoomInfo [] which is the result of * availableRooms method. * * @param roomID the roomID is the primary key of the room information * @param fromDate the date from which the room will be rented * @param Todate the date to which the room will be rented * @para m customerName the customer's name, there should be other information of * the customer. Maybe a class which supports the customer infor is needed. * / public void rentRoom (int roomID, Date fromDate, Date toDate, String customerName) {} / ** * This method is used to reserve a room, since the availableRooms method had to be * called before this function (else you will have no idea of which room is availble * to rent), so we can get a roomID form the RoomInfo [] Which is the result of * availablerooms method. * * @Param roomiD the room information * @Param fromDate the date from which the room will be rented * @
param toDate the date to which the room will be rented * @param customerName the customer's name, there should be other information of * the customer. Maybe a class which supports the customer infor is needed. * / public void reserveRoom (int roomID, Date fromDate, Date toDate, String customerName) {} / ** * * used to cancel reservation, if the customer remebered the reserveInID. * * @param reserveInfoID the primary key of reserveInfo. * / public void cancelReservation (int reserveInfoID) {} / ** * used to cancel reservation when the customer forget the reserveInfoID * Of course he should remeber his name though he could forget anything. * * @param customName supports the search the reserveInfo which should be canceled. * / public void cancelReservation (String customName ) {} / ** * Used to check out. * * @Param roomid the roominfo primary key * * do you think of the checkout? * Maybe, But I think the roomid is always available. IT May Be the room's key name. * / public void checkout (int roomid) {}} Ok, the development documentation of this hotel system is here. The content will inevitably make all people miss. But this is not the result I hope. Anyway, thank you.
Copyright: IDILENT website reproduced please indicate the author's other reprint, please contact the author (iDilent@yahoo.com.cn).