public static void updatePlotColumns(List<String> plotCols, Session session) { try { makeSureSessionExistsInDB(session.getUser().getUserId()); Statement statement = conn.createStatement(); statement.executeUpdate("update sessions set vis='" + StringEscapeUtils.escapeJava(Joiner.on(',').join(plotCols)) + "'where id='" + cleanId(session.getUser().getUserId()) + "';"); } catch (SQLException e) { log.error(e.getMessage()); } }
AlexaClient(final AlexaClientBuilder builder) { this.millisFromCurrentDate = builder.timestamp.getTime() - new Date().getTime(); this.locale = builder.locale; apiEndpoint = apiEndpoints.getOrDefault(builder.apiEndpoint, apiEndpoints.get(NA)); this.application = new Application(builder.applicationId); this.user = User.builder().withUserId(builder.uid).withAccessToken(builder.accessToken).build(); this.device = builder.device; this.debugFlagSessionAttributeName = StringUtils.isNullOrEmpty(builder.debugFlagSessionAttributeName) ? Optional.empty() : Optional.of(builder.debugFlagSessionAttributeName); this.endpoint = builder.endpoint; this.yLaunch = builder.yLaunch; }
Permissions permissions = session.getUser().getPermissions(); if (permissions == null) { log.info("The user hasn't authorized the skill. Sending a permissions card.");
public static void updateResultData(JSONObject data, Session session) { try { makeSureSessionExistsInDB(session.getUser().getUserId()); Statement statement = conn.createStatement(); statement.executeUpdate("update sessions set result='" + StringEscapeUtils.escapeJava(data.toString()) + "'where id='" + cleanId(session.getUser().getUserId()) + "';"); } catch (SQLException e) { log.error(e.getMessage()); } }
private Session givenSession(final String applicationId) { final Application application = new Application(applicationId); final User user = User.builder().withUserId(userId).withAccessToken("accessToken").build(); return Session.builder().withSessionId(sessionId) .withApplication(application).withUser(user).build(); }
public static void updateDisplayText(String message, Session session) { try { makeSureSessionExistsInDB(session.getUser().getUserId()); Statement statement = conn.createStatement(); statement.executeUpdate("update sessions set display='" + StringEscapeUtils.escapeJava(message) + "' where id='" + cleanId(session.getUser().getUserId()) + "';"); } catch (SQLException e) { log.error(e.getMessage()); } }
private SpeechletResponse handleRequest(SpeechletRequest request, Session session) { try { if (! config.allowUser(session.getUser().getUserId())) { throw new SecurityException("User not in whitelist: " + session.getUser().getUserId()); } final ProxyResponse proxyResponse = postRequest(request, session); final SpeechletResponse response = buildResponse(proxyResponse.getSpeech()); response.setShouldEndSession(proxyResponse.isShouldEndSession()); return response; } catch (IOException e) { LOG.error("Error processing request", e); return buildResponse("Error communicating with remote proxy server"); } }
session.getUser().getUserId()).getJSONArray("sessions.result") .getString(0)); for (ColumnName axis : axes) {
/** * Saves the {@link ScoreKeeperGame} into the database. * * @param game */ public void saveScoreKeeperGame(ScoreKeeperGame game) { ScoreKeeperUserDataItem item = new ScoreKeeperUserDataItem(); item.setCustomerId(game.getSession().getUser().getUserId()); item.setGameData(game.getGameData()); dynamoDbClient.saveItem(item); } }
/** * Reads and returns the {@link ScoreKeeperGame} using user information from the session. * <p> * Returns null if the item could not be found in the database. * * @param session * @return */ public ScoreKeeperGame getScoreKeeperGame(Session session) { ScoreKeeperUserDataItem item = new ScoreKeeperUserDataItem(); item.setCustomerId(session.getUser().getUserId()); item = dynamoDbClient.loadItem(item); if (item == null) { return null; } return ScoreKeeperGame.newInstance(session, item.getGameData()); }
/** * Saves the {@link ScoreKeeperGame} into the database. * * @param game */ public void saveScoreKeeperGame(ScoreKeeperGame game) { ScoreKeeperUserDataItem item = new ScoreKeeperUserDataItem(); item.setCustomerId(game.getSession().getUser().getUserId()); item.setGameData(game.getGameData()); dynamoDbClient.saveItem(item); } }
/** * Reads and returns the {@link ScoreKeeperGame} using user information from the session. * <p> * Returns null if the item could not be found in the database. * * @param session * @return */ public ScoreKeeperGame getScoreKeeperGame(Session session) { ScoreKeeperUserDataItem item = new ScoreKeeperUserDataItem(); item.setCustomerId(session.getUser().getUserId()); item = dynamoDbClient.loadItem(item); if (item == null) { return null; } return ScoreKeeperGame.newInstance(session, item.getGameData()); }