summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Bank.java
blob: 625978e5be8e84a19e963aebca22141f0b5dcada (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package examples.entity.intro;

import java.util.List;

/**
 * Business interface of the Bank session bean, a facade for the
 * Account entity bean.
 */

public interface Bank {

    /**
     * List accounts in the bank
     * @return the list of accounts
     */
    List<Account> listAccounts();

    /**
     * Opens a new account
     * @param ownerName
     * @return the account object 
     */
    Account openAccount(String ownerName);

    Account openAccount(String ownerName, int accNum);
    
    void printBigAccounts();
    
    /**
     * Find out the balance of account with given accountNumber
     * @param accountNumber
     * @return the current balance
     */
    int getBalance(int accountNumber);

    /**
     * Increases the balance of account with given accountNumber by amount 
     * @param accountNumber
     * @param amount the amount
     */
    void deposit(int accountNumber, int amount);

    /**
     * Withdraws a given amount, the current balance permitting 
     * @param accountNumber
     * @param amount 
     * @return amount, if successful, 0 otherwise
     */
    int withdraw(int accountNumber, int amount);

    public void checkBalance(int accountNumber);
    
    /**
     * Destroys the entity permanently
     * @param accountNumber
     */
    void close(int accountNumber);
    
    void update(Account a);
}