MCPcopy Index your code
hub / github.com/aws-samples/eb-java-scorekeep / loadGames

Method loadGames

src/main/java/scorekeep/GameModel.java:38–57  ·  view source on GitHub ↗
(String sessionId)

Source from the content-addressed store, hash-verified

36 }
37
38 public List<Game> loadGames(String sessionId) throws SessionNotFoundException {
39 if ( sessionModel.loadSession(sessionId) == null ) {
40 throw new SessionNotFoundException(sessionId);
41 }
42 Map<String, AttributeValue> eav = new HashMap<String, AttributeValue>();
43 eav.put(":val1", new AttributeValue().withS(sessionId));
44
45 Map<String, String> ean = new HashMap<String, String>();
46 ean.put("#key1", "session");
47
48 DynamoDBQueryExpression<Game> queryExpression = new DynamoDBQueryExpression<Game>()
49 .withIndexName("session-index")
50 .withExpressionAttributeValues(eav)
51 .withExpressionAttributeNames(ean)
52 .withKeyConditionExpression("#key1 = :val1")
53 .withConsistentRead(false);
54
55 List<Game> sessionGames = mapper.query(Game.class, queryExpression);
56 return sessionGames;
57 }
58
59 public void deleteGame(String sessionId, String gameId) throws GameNotFoundException {
60 Game game = mapper.load(Game.class, gameId);

Callers 1

getGamesMethod · 0.80

Calls 1

loadSessionMethod · 0.80

Tested by

no test coverage detected