EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.dao]

COVERAGE SUMMARY FOR SOURCE FILE [AccountDAOImpl.java]

nameclass, %method, %block, %line, %
AccountDAOImpl.java100% (1/1)100% (7/7)100% (81/81)100% (20/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AccountDAOImpl100% (1/1)100% (7/7)100% (81/81)100% (20/20)
AccountDAOImpl (SqlMapClient): void 100% (1/1)100% (4/4)100% (2/2)
insertAccount (Account): void 100% (1/1)100% (7/7)100% (2/2)
selectActiveAccounts (): List 100% (1/1)100% (5/5)100% (1/1)
selectAllAccounts (): List 100% (1/1)100% (5/5)100% (1/1)
selectMaxDiscriminator (): int 100% (1/1)100% (14/14)100% (4/4)
updateAccount (Account): void 100% (1/1)100% (29/29)100% (5/5)
updatePassword (int, String): void 100% (1/1)100% (17/17)100% (5/5)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.dao;
16 
17import java.sql.SQLException;
18import java.util.List;
19 
20import net.sourceforge.hiveboard.Account;
21import net.sourceforge.hiveboard.StaleObjectException;
22import net.sourceforge.hivetranse.transaction.ibatis.AbstractSqlMapClientDAO;
23 
24import com.ibatis.sqlmap.client.SqlMapClient;
25 
26public class AccountDAOImpl extends AbstractSqlMapClientDAO
27{
28        public AccountDAOImpl(SqlMapClient client)
29        {
30                super(client);
31        }
32        
33        public List<Account>                selectActiveAccounts() throws SQLException
34        {
35                return queryForList("SelectActiveAccounts", null);
36        }
37        
38        public List<Account>                selectAllAccounts() throws SQLException
39        {
40                return queryForList("SelectAllAccounts", null);
41        }
42        
43        public int                selectMaxDiscriminator() throws SQLException
44        {
45                Integer max = (Integer) _client.queryForObject("SelectMaxAccountDiscriminator", null);
46                if (max != null)
47                {
48                        return max.intValue();
49                }
50                else
51                {
52                        return 0;
53                }
54        }
55        
56        public void                insertAccount(Account account) throws SQLException
57        {
58                _client.insert("InsertAccount", account);
59        }
60        
61        public void                updateAccount(Account account) throws SQLException
62        {
63                if (_client.update("UpdateAccount", account) == 1)
64                {
65                        account.setVersion(account.getVersion() + 1);
66                }
67                else
68                {
69                        throw new StaleObjectException(
70                                        "Account has been modified by another system [" + account + "]");
71                }
72        }
73 
74        public void                updatePassword(int id, String password) throws SQLException
75        {
76                Account account = new Account();
77                account.setId(id);
78                account.setPassword(password);
79                _client.update("UpdateAccountPassword", account);
80        }
81}

[all classes][net.sourceforge.hiveboard.dao]
EMMA 2.0.5312 (C) Vladimir Roubtsov