View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.shiro.samples.aspectj.bank;
20  
21  import java.util.Date;
22  
23  public interface BankService {
24  
25      public long[] searchAccountIdsByOwner(String anOwnerName);
26  
27      public long createNewAccount(String anOwnerName);
28  
29      public double getBalanceOf(long anAccountId) throws AccountNotFoundException;
30  
31      public String getOwnerOf(long anAccountId) throws AccountNotFoundException;
32  
33      public double depositInto(long anAccountId, double anAmount) throws AccountNotFoundException, InactiveAccountException;
34  
35      public double withdrawFrom(long anAccountId, double anAmount) throws AccountNotFoundException, NotEnoughFundsException, InactiveAccountException;
36  
37      public TxLog[] getTxHistoryFor(long anAccountId) throws AccountNotFoundException;
38  
39      public double closeAccount(long anAccountId) throws AccountNotFoundException, InactiveAccountException;
40  
41      public boolean isAccountActive(long anAccountId) throws AccountNotFoundException;
42  
43      public static class TxLog {
44          private Date _creationDate;
45          private double _amount;
46          private String _madeBy;
47  
48          public TxLog(Date aCreationDate, double aAmount, String aMadeBy) {
49              super();
50              _creationDate = aCreationDate;
51              _amount = aAmount;
52              _madeBy = aMadeBy;
53          }
54  
55          /**
56           * Returns the creationDate attribute.
57           *
58           * @return The creationDate value.
59           */
60          public Date getCreationDate() {
61              return _creationDate;
62          }
63  
64          /**
65           * Returns the amount attribute.
66           *
67           * @return The amount value.
68           */
69          public double getAmount() {
70              return _amount;
71          }
72  
73          /**
74           * Returns the madeBy attribute.
75           *
76           * @return The madeBy value.
77           */
78          public String getMadeBy() {
79              return _madeBy;
80          }
81      }
82  
83  }