View Javadoc

1   /***
2    Copyright (C) 2005 The Java Community
3   
4    This program is free software; you can redistribute it and/or modify  it under
5    the terms of the GNU General Public License as published by  the Free Software
6    Foundation; either version 2 of the License, or  (at your option) any later
7    version.
8   
9    This program is distributed in the hope that it will be useful,  but WITHOUT
10   ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the  GNU General Public License for more details.
12  
13   You should have received a copy of the GNU General Public License  along with
14   this program; if not, write to the Free Software  Foundation, Inc., 59 Temple
15   Place, Suite 330, Boston, MA 02111-1307 USA.
16  
17   */
18  package org.bejug.javacareers.jobs.dao;
19  
20  import java.util.List;
21  
22  import org.bejug.javacareers.common.exception.DuplicateUserNameException;
23  import org.bejug.javacareers.common.exception.LastAdminException;
24  import org.bejug.javacareers.jobs.model.User;
25  import org.springframework.dao.DataAccessException;
26  
27  /***
28   * The User Data Access Object interface.
29   * 
30   * @author Sven Schauwvliege (Last modified by $Author: schauwvliege $) 
31   * @version $Revision: 1.2 $ - $Date: 2005/09/13 08:11:17 $
32   */
33  public interface UserDao {
34  
35      /***
36       * Lists all users.
37       * @return a List containing all users
38       * @throws DataAccessException thrown when something goes wrong
39       */
40      List getUsers() throws DataAccessException;
41  
42      /***
43       * Adds and updates an user type to the database.
44       * @param user the User to add
45       * @throws DataAccessException thrown when something goes wrong when adding
46       * an user
47       * @throws DuplicateUserNameException thrown when username is already in use
48       * @throws LastAdminException thrown when trying to delete the last admin.
49       */
50      void store(User user) throws DataAccessException,
51                                     DuplicateUserNameException, LastAdminException;
52  
53      /***
54       * Gets an User by id.
55       * @param id the id of the User
56       * @return the wanted User or null if not found
57       * @throws DataAccessException thrown when something goes wrong when getting
58       * an User
59       */
60      User getUser(Integer id) throws DataAccessException;
61  
62      /***
63       * Delete an User by id.
64       * @param user The user.
65       * @throws DataAccessException thrown when something goes wrong
66       * @throws LastAdminException if someone deletes the last username.
67       */
68      void deleteUser(User user) throws DataAccessException, LastAdminException ;
69      
70      /***
71       * Delete an User by id.
72       * @param id The user identifier.
73       * @throws DataAccessException thrown when something goes wrong
74       * @throws LastAdminException if someone deletes the last username.
75       */
76      void deleteUser(Integer id) throws DataAccessException, LastAdminException ;
77      
78      /***
79       * Gets an User by username.
80       * @param userName of the User
81       * @return the wanted User or null if not found
82       * @throws DataAccessException thrown when something goes wrong when getting
83       * an User
84       */
85      User getUserByUserName(String userName)throws DataAccessException;
86  }
87  /***
88   *
89   * $Log: UserDao.java,v $
90   * Revision 1.2  2005/09/13 08:11:17  schauwvliege
91   * organize imports
92   *
93   * Revision 1.1  2005/08/26 07:58:30  ge0ffrey
94   * split up the sources in service, serviceimpl and webclient
95   *
96   * Revision 1.8  2005/08/16 09:10:15  bme_jcs
97   * checkstyle errors resolved
98   *
99   * Revision 1.7  2005/08/11 10:26:32  bavo_jcs
100  * Role change rule
101  *
102  * Revision 1.6  2005/08/10 09:04:49  bavo_jcs
103  * Optimized imports according to checkstyle
104  *
105  * Revision 1.5  2005/08/09 12:59:55  bavo_jcs
106  * Optimized imports
107  *
108  * Revision 1.4  2005/08/03 13:14:18  bme_jcs
109  * getDao's removed and storeObject renamed to store
110  *
111  * Revision 1.3  2005/06/14 13:40:04  schauwvliege
112  * Renamed add to store
113  *
114  * Revision 1.2  2005/06/09 08:18:44  bejug_cc
115  * Fix initial import
116  *
117  * Revision 1.11  2005/06/07 12:12:56  ssc
118  * Delete last admin exception
119  *
120  * Revision 1.10  2005/05/17 11:59:56  ssc
121  * Refactored User and Publisher class to User Class added cvAdded Boolean, added Address to user, Fixed test to work with this setup
122  *
123  * Revision 1.9  2005/05/12 08:23:55  ssc
124  * Checkstyle errors
125  *
126  * Revision 1.8  2005/05/11 16:43:50  sja
127  * Uses DuplicateUserNameException from correct package location.
128  *
129  * Revision 1.7  2005/05/09 12:31:29  ssc
130  * Added duplicate username exception
131  *
132  * Revision 1.6  2005/05/04 11:19:56  sja
133  * Corrected JavaDoc.
134  *
135  * Revision 1.5  2005/05/04 11:18:47  sja
136  * Added CVS Tag.
137  *
138  * Revision 1.4  2005/05/02 13:25:42  ssc
139  * First release
140  *
141  *
142  */
143