旅店管理系統中clerk的詳細描述 (轉)

gugu99發表於2007-08-16
旅店管理系統中clerk的詳細描述 (轉)[@more@]

在“旅店管理中的類的概述”完成之後,我又仔細的審查了自己關於各個類的定義,我發現自己竟不知不覺地走入了(Enterprise Bean)的範疇,從我在前文中定義的概念可以看出其中房間資訊,預定資訊以及租用資訊屬於EJB中的實體Bean(確切地說應該是實體Bean中的Bean類我將它稱之為實體類),而管理人員和旅店服務人員應該是EJB中的會話Bean中的Bean類(我在這把它叫做會話類)。(另外查詢資訊,是一個沒有很好地解釋的類,正像前面說得那樣,這個類的存在與否是一個問題所在。)我不知道別人在實際的實際過程中會不會出現這樣的情況,是我感到疑問的是在沒有出現EJB之前,設計者在分析設計的過程中也會得到這樣的結果嗎?如果是這樣的話,EJB這種概念應該是在java出現之前就應該出現,是不是像我說得這樣呢?希望那位知道的讀者告訴我關於OO的設計過程中是不是很早就提出了這種對於的分類。

而如果情況真的如我分析的那樣的話,我們在實體類中就沒有過多的內容要詳細描述(可能會在的定義之後進行詳細地描述),因為實體Bean的作用主要是想JC或者其他一些後端的經常訪問的資料提供一個物件導向的介面,也就是說實體類其實是對資料庫的內容在程式中的一種體現。當然我們在具體實現的過程中可能會使用特殊的處理手段,比如將某欄位作為物件單獨處理等。我在下面只是簡單得給這些類(本以為這些內容會以介面的形式存在,從而便與支援,不想不知不覺走入了EJB的範疇,)一個名字以供下面的內容使用。

1、房間資訊:RoomInfo
2、預定資訊:ReserveInfo
3、租用資訊:RentInfo

接著我們來處理一下旅店服務員這個主要的會話物件的主要幾個功能,並把它們定義成旅店服務員的方法(關於管理員的查詢以後再作補充)。

我們先為旅店服務員著個類起名為HostelClerk,一下是HotelClerk類的主要部分(沒有提供對於會話Bean介面的實現)。

import java.util.*;

/*
 * Created on -7-28
 */

/**
 * This class is used in Hostel MIS. It is the class which implements
 * room renting, reserving, check out and other main function.
 *
 * @author idilent
 */
public class HostelClerk {
 

 /**
  * 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 a of which room is availble
  * to rent), so we can get a roomID fothe 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
  * @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 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 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
  * @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 there should be another version 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){
 } 
}

好了,這個旅店系統的開發文件就在這裡告一段落。其中內容必然讓所有的人大失所望。但是這也不是我希望的結果。無論如何,謝謝大家。


版權所有:idilent 網站轉載請註明作者 其他轉載方式請與作者聯絡(to:idilent@.com.cn">idilent@yahoo.com.cn)。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10748419/viewspace-960971/,如需轉載,請註明出處,否則將追究法律責任。

相關文章