MCPcopy Create free account
hub / github.com/aws-samples/eb-java-scorekeep / loadMoves

Method loadMoves

src/main/java/scorekeep/MoveModel.java:42–64  ·  view source on GitHub ↗
(String sessionId, String gameId)

Source from the content-addressed store, hash-verified

40 }
41
42 public List<Move> loadMoves(String sessionId, String gameId) throws SessionNotFoundException, GameNotFoundException {
43 if ( sessionModel.loadSession(sessionId) == null ) {
44 throw new SessionNotFoundException(sessionId);
45 }
46 if ( gameModel.loadGame(gameId) == null ) {
47 throw new GameNotFoundException(gameId);
48 }
49 Map<String, AttributeValue> eav = new HashMap<String, AttributeValue>();
50 eav.put(":val1", new AttributeValue().withS(gameId));
51
52 Map<String, String> ean = new HashMap<String, String>();
53 ean.put("#key1", "game");
54
55 DynamoDBQueryExpression<Move> queryExpression = new DynamoDBQueryExpression<Move>()
56 .withIndexName("game-index")
57 .withExpressionAttributeValues(eav)
58 .withExpressionAttributeNames(ean)
59 .withKeyConditionExpression("#key1 = :val1")
60 .withConsistentRead(false);
61
62 List<Move> gameMoves = mapper.query(Move.class, queryExpression);
63 return gameMoves;
64 }
65
66 public void deleteMove(String moveId) throws MoveNotFoundException {
67 Move move = mapper.load(Move.class, moveId);

Callers 1

getMovesMethod · 0.80

Calls 2

loadSessionMethod · 0.80
loadGameMethod · 0.80

Tested by

no test coverage detected