(String sessionId, String gameId)
| 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); |
no test coverage detected