Used to decipher whether or not a user exists as an admin @param userId The user identifier of the admin to be found @return A boolean reflecting the state of existence of the admin
(String ApplicationRoot, String userId)
| 1961 | * @return A boolean reflecting the state of existence of the admin |
| 1962 | */ |
| 1963 | public static boolean findAdminById (String ApplicationRoot, String userId) |
| 1964 | { |
| 1965 | log.debug("*** Getter.findAdminById ***"); |
| 1966 | boolean userFound = false; |
| 1967 | //Get connection |
| 1968 | Connection conn = Database.getCoreConnection(ApplicationRoot); |
| 1969 | try |
| 1970 | { |
| 1971 | CallableStatement callstmt = conn.prepareCall("call adminFindById(?)"); |
| 1972 | log.debug("Gathering adminFindById ResultSet"); |
| 1973 | callstmt.setString(1, userId); |
| 1974 | ResultSet userFind = callstmt.executeQuery(); |
| 1975 | log.debug("Opening Result Set from adminFindById"); |
| 1976 | userFind.next(); //This will throw an exception if player not found |
| 1977 | log.debug("Admin Found: " + userFind.getString(1)); //This line will not execute if admin not found |
| 1978 | userFound = true; |
| 1979 | } |
| 1980 | catch(Exception e) |
| 1981 | { |
| 1982 | log.error("Admin does not exist: " + e.toString()); |
| 1983 | userFound = false; |
| 1984 | } |
| 1985 | Database.closeConnection(conn); |
| 1986 | log.debug("*** END findAdminById ***"); |
| 1987 | return userFound; |
| 1988 | } |
| 1989 | } |