List of usage examples for com.amazonaws.services.dynamodbv2.document Item asMap
public Map<String, Object> asMap()
From source file:com.erudika.para.persistence.AWSDynamoDAO.java
License:Apache License
private <P extends ParaObject> String readPageFromSharedTable(String appid, Pager pager, LinkedList<P> results) { String lastKeyFragment = ""; ValueMap valueMap = new ValueMap().withString(":aid", appid); NameMap nameMap = null;/*from www . ja v a 2 s.co m*/ if (!StringUtils.isBlank(pager.getLastKey())) { lastKeyFragment = " and #stamp > :ts"; valueMap.put(":ts", pager.getLastKey()); nameMap = new NameMap().with("#stamp", Config._TIMESTAMP); } Index index = getSharedIndex(); QuerySpec spec = new QuerySpec().withMaxPageSize(pager.getLimit()).withMaxResultSize(pager.getLimit()) .withKeyConditionExpression(Config._APPID + " = :aid" + lastKeyFragment).withValueMap(valueMap) .withNameMap(nameMap); if (index != null) { Page<Item, QueryOutcome> items = index.query(spec).firstPage(); for (Item item : items) { P obj = ParaObjectUtils.setAnnotatedFields(item.asMap()); if (obj != null) { results.add(obj); } } } if (!results.isEmpty()) { return Long.toString(results.peekLast().getTimestamp()); } else { return null; } }