KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > acl > eventhandler > ACUtils


1 package de.webman.acl.eventhandler;
2
3 import java.sql.*;
4
5 import com.teamkonzept.lib.*;
6 import com.teamkonzept.db.*;
7 import com.teamkonzept.webman.mainint.*;
8 import de.webman.acl.db.queries.GetLoginByName;
9 /**
10  * @author $Author: sebastian $
11  * @version $Revision: 1.1 $
12 */

13 public class ACUtils
14 {
15     /** @see checkLoginExistance(String login, Integer id)
16         @param login (the login)
17         @return true if login already exists
18         @throws SQLException - throws SQLException id database lookup fails
19     */

20     public static boolean checkLoginExistance(String JavaDoc login) throws SQLException
21     {
22         return checkLoginExistance(login, new Integer JavaDoc(-1));
23     }
24     
25     /** checks whether the given <login> already exists ignoring
26         the login with the given id
27         @param login (the login)
28         @param id (the user id to ignore) - if id is null id is not ignored
29         @return true if login already exists; else false
30         @throws SQLException - throws SQLException id database lookup fails
31     */

32     public static boolean checkLoginExistance(String JavaDoc login, Integer JavaDoc id) throws SQLException
33     {
34         TKQuery q;
35         q = (TKPrepQuery)TKDBManager.newQuery(GetLoginByName.class);
36         q.setQueryParams( "LOGIN", login);
37         q.setQueryParams( "USER_ID", id);
38         q.execute();
39         ResultSet rs = q.fetchResultSet();
40         if (rs == null || !rs.next())
41             return false;
42         return true;
43     }
44 }
Popular Tags