MCPcopy Create free account
hub / github.com/OWASP/SecurityShepherd / findPlayerById

Method findPlayerById

src/main/java/dbProcs/Getter.java:201–226  ·  view source on GitHub ↗

Used to decipher whether or not a user exists as a player @param userId The user identifier of the player to be found @return A boolean reflecting the state of existence of the player

(String ApplicationRoot, String userId)

Source from the content-addressed store, hash-verified

199 * @return A boolean reflecting the state of existence of the player
200 */
201 public static boolean findPlayerById (String ApplicationRoot, String userId)
202 {
203 log.debug("*** Getter.findPlayerById ***");
204 boolean userFound = false;
205 //Get connection
206 Connection conn = Database.getCoreConnection(ApplicationRoot);
207 try
208 {
209 CallableStatement callstmt = conn.prepareCall("call playerFindById(?)");
210 log.debug("Gathering playerFindById ResultSet");
211 callstmt.setString(1, userId);
212 ResultSet userFind = callstmt.executeQuery();
213 log.debug("Opening Result Set from playerFindById");
214 userFind.next(); //This will throw an exception if player not found
215 log.debug("Player Found: " + userFind.getString(1)); //This line will not execute if player not found
216 userFound = true;
217 }
218 catch(Exception e)
219 {
220 log.error("Player did not exist: " + e.toString());
221 userFound = false;
222 }
223 Database.closeConnection(conn);
224 log.debug("*** END findPlayerById ***");
225 return userFound;
226 }
227
228 /**
229 * Used to gather all module information for internal functionality. This method is used in creating View's or in control class operations

Callers 10

testFindPlayerByIdMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95

Calls 2

getCoreConnectionMethod · 0.95
closeConnectionMethod · 0.95

Tested by 3

testFindPlayerByIdMethod · 0.76