(******************************************
** Bank Model ISL Definition **
** **
** by Y. Akamatsu **
** **
** $Revision: 1.5 $ **
** $Author: akamatsu $ **
** $Date: 1996/10/30 19:00:18 $ **
******************************************)
INTERFACE IBankModel
IMPORTS IDLInterchange, IAny
END;
(******************************************
** **
** definition of the basic types **
** **
******************************************)
TYPE AccountList = SEQUENCE OF Account;
TYPE TransactionList = SEQUENCE OF Transaction;
TYPE CheckList = SEQUENCE OF Check;
TYPE CString = SEQUENCE OF SHORT CHARACTER;
TYPE TString = OPTIONAL CString;
(******************************************
** **
** ilu exceptions **
** **
******************************************)
EXCEPTION BankError : CString;
EXCEPTION AccountError : CString;
EXCEPTION CurrencyError : CString;
(******************************************
** **
** ilu Bank class **
** **
** An instance of this class represents **
** a bank such as Stanford Bucks Bank. **
** But please note that the instance is **
** NOT an ATM.So only a single instance **
** should be generated on the server **
** side. **
** **
******************************************)
TYPE Bank = OBJECT
METHODS
(* Creates a new account and return the instance of the Account *)
OpenAccount(pName : CString, pInitBalance : Amount) : Account
RAISES BankError END,
(* Remove a specified account from the Bank Repository *)
CloseAccount(pAccount : Account)
RAISES BankError END,
(* Get a list of the All Account instances *)
GetAllAccounts() : AccountList,
(* Get an Account instance by the specified ID *)
GetAccountByNumber(pAccountNumber : LONG INTEGER) : Account
RAISES BankError END,
(* Get a list of Account instances by the specified name *)
GetAccountsByName(pName : CString) : AccountList,
(* Get a name of the bank *)
GetName() : CString,
(* Flush the cache. Must be called at the end of the client transaction *)
Flush(),
(* Get a constrainCollection instance for the Accounts *)
GetAccountCollection() : IDLInterchange.CCollection,
(* Get a constrainCollection instance for the Transactions *)
GetTransactionCollection() : IDLInterchange.CCollection,
(* Get a constrainCollection instance for the Checks *)
GetCheckCollection() : IDLInterchange.CCollection
END;
(******************************************
** **
** ilu Accoount class **
** **
** An instance of this class represents **
** an account of the Bank. **
** This class is a subclass of DLColle- **
** ction.Item actually. But on this **
** interface, it was encapsulated. **
** **
******************************************)
TYPE Account = OBJECT
METHODS
(* Deposit Money to this account *)
Deposit(pAmount: Amount, pDescription: TString)
RAISES CurrencyError END,
(* Withdraw Money from this account *)
Withdraw(pAmount: Amount, pDescription: TString)
RAISES AccountError, CurrencyError END,
(* Get a list of all the instances of the Transaction *)
GetAllTransactions() : TransactionList,
(* Get a name of the person of this account *)
GetName() : CString,
(* Get an account number *)
GetAccountNumber() : LONG INTEGER,
(* Get a current balance for this account
Note that the return type is IBankModel.Amount, not BankMode.Amount *)
GetBalance() : Amount,
(* Get a list of the instances of the USED checks *)
GetAllChecks() : CheckList,
(* Get a list of the instances of the check which was paid to pName *)
GetChecksByPayee(pName : CString) : CheckList,
(* Get a list of the instances of the check
whose reference string is pReference *)
GetChecksByReference(pReference : CString) : CheckList,
(* Create a new check for this account *)
MakeCheck(pAmount: Amount, pToWhom: TString, pReference: TString) : Check,
(* Deposit other person's check into this account *)
DepositCheck(pCheck : Check)
RAISES AccountError, CurrencyError END,
(* a string expression for this account *)
Describe() : CString
END;
(******************************************
** **
** ilu Transaction class **
** **
** An instance of this class represents **
** a transaction for the accounts. **
** This class is a subclass of DLColle- **
** ction.Item actually. But on this **
** interface, it was encapsulated. **
** **
******************************************)
TYPE Transaction = OBJECT
METHODS
(* Get an account number for this transaction *)
GetAccountNumber() : LONG INTEGER,
(* Get an transaction number for this transaction *)
GetTransactionNumber() : INTEGER,
(* Get a date of this transaction. Date is sec. represented *)
GetDate() : REAL,
(* Get a description of this transaction *)
GetDescription() : CString,
(* Get an instance of the Amount of this transaction *)
GetAmount() : Amount,
(* Get a string representation of this transaction *)
Describe() : CString
END;
(******************************************
** **
** ilu Check class **
** **
** An instance of this class represents **
** a check of the accounts **
** Please note that this class will be **
** stored into the shelve only when **
** the payment is completed. **
** This class is a subclass of DLColle- **
** ction.Item actually. But on this **
** interface, it was encapsulated. **
** **
******************************************)
TYPE Check = OBJECT
METHODS
(* Get a reference ID string of this check *)
GetReference() : CString,
(* Get a date of this check. Date is sec. represented *)
GetDate() : REAL,
(* Get a name to whom this check will be paid. *)
GetToWhom() : CString,
(* Get an account number of the person who issued this check *)
GetAccountNumber() : LONG INTEGER,
(* Get an instance of the Amount of this check *)
GetAmount() : Amount,
(* Get a number of this check *)
GetCheckNumber() : INTEGER,
(* Get a string representation of this check *)
Describe() : CString
END;
(******************************************
** **
** ilu Amount record **
** **
** This record is an representation of **
** the digital currency. **
** In the bank model I have customized **
** this class to be more feasible. **
** **
******************************************)
TYPE Amount = RECORD
(* Number is a numerical part of the money *)
Number : REAL,
(* Units is a currency unit. ex. 'USD', 'JPY', etc. *)
Units : CString
END;