List of usage examples for com.amazonaws.services.dynamodbv2.document.utils ValueMap withMap
public ValueMap withMap(String key, Map<String, ?> val)
From source file:com.exorath.service.lobbymsg.impl.DynamoDBService.java
License:Apache License
public static UpdateItemSpec getUpdateItemSpec(String gameId, Message message) { String updateExpression;// w w w . j a va 2 s.c om ValueMap valueMap = new ValueMap(); if (message.getMsg() == null) updateExpression = "REMOVE " + MSGS_FIELD + "." + gameId; else { updateExpression = "SET " + MSGS_FIELD + "." + gameId + "=:msgMap"; ValueMap msgMap = new ValueMap().withString(MSG_FIELD, message.getMsg()); if (message.getFormat() != null) msgMap.withString(FORMAT_FIELD, message.getFormat()); valueMap.withMap(":msgMap", msgMap); } if (valueMap.isEmpty()) valueMap = null; System.out.println(updateExpression); return new UpdateItemSpec().withPrimaryKey(getPrimaryKey()).withUpdateExpression(updateExpression) .withValueMap(valueMap); }