@Override public Boolean addGame( String campusSession, String nameGame, int idGame, int idCategory, Date creationDate) { try { // Add the game if user exists, game does not exists, there is a name, there is a creation // date and category exists if (sBo.validateSession(campusSession) != null && gDao.getGame(idGame) == null && cDao.getCategory(idCategory) != null && gDao.getGameByName(nameGame) == null && !nameGame.equals("")) { Game objGame = new Game(); objGame.setIdGame(idGame); objGame.setName(nameGame); objGame.setPublicAcces(1); objGame.setSecretGame(Security.getIdGame()); objGame.setPrivateKey(Security.getIdSession()); objGame.setIdCategory(idCategory); objGame.setCreationDate(creationDate); gDao.addGame(objGame); } else return false; } catch (Exception e) { e.printStackTrace(); return false; } return true; }
@Override public Boolean addGame(String campusSession, String nameGame, int idGame) { try { if (sBo.validateSession(campusSession) != null) { Game objGame = new Game(); objGame.setIdGame(idGame); objGame.setName(nameGame); objGame.setPublicAcces(1); objGame.setSecretGame(Security.getIdGame()); objGame.setPrivateKey(Security.getIdSession()); gDao.addGame(objGame); } } catch (Exception e) { e.printStackTrace(); return false; } return true; }
@Override public Game getGame(String idGame, String campusSession) { Game objGame = null; try { if (Security.isIdGame(idGame)) objGame = gDao.getGameUid(idGame); else { if (sBo.validateSession(campusSession) != null) { objGame = gDao.getGame(Integer.parseInt(idGame)); } else { return null; } } } catch (Exception e) { e.printStackTrace(); return null; } return objGame; }