/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * * @param attributesToGet * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a * href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public GetItemRequest withAttributesToGet(java.util.Collection<String> attributesToGet) { setAttributesToGet(attributesToGet); return this; }
public GetItemSpec withAttributesToGet(String ... attrNames) { if (attrNames == null) getRequest().setAttributesToGet(null); else getRequest().setAttributesToGet(Arrays.asList(attrNames)); return this; }
/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setAttributesToGet(java.util.Collection)} or {@link #withAttributesToGet(java.util.Collection)} if you * want to override the existing values. * </p> * * @param attributesToGet * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a * href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public GetItemRequest withAttributesToGet(String... attributesToGet) { if (this.attributesToGet == null) { setAttributesToGet(new java.util.ArrayList<String>(attributesToGet.length)); } for (String ele : attributesToGet) { this.attributesToGet.add(ele); } return this; }
@Override public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("readkey: " + key + " from table: " + table); } GetItemRequest req = new GetItemRequest(table, createPrimaryKey(key)); req.setAttributesToGet(fields); req.setConsistentRead(consistentRead); GetItemResult res; try { res = dynamoDB.getItem(req); } catch (AmazonServiceException ex) { LOGGER.error(ex); return Status.ERROR; } catch (AmazonClientException ex) { LOGGER.error(ex); return CLIENT_ERROR; } if (null != res.getItem()) { result.putAll(extractResult(res.getItem())); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Result: " + res.toString()); } } return Status.OK; }
greq.setAttributesToGet(fields);
/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> * instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param attributesToGet <p> * This is a legacy parameter. Use * <code>ProjectionExpression</code> instead. For more * information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer * Guide</i>. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public GetItemRequest withAttributesToGet(java.util.Collection<String> attributesToGet) { setAttributesToGet(attributesToGet); return this; }
private Document getItem(Key key, GetItemOperationConfig config) { final GetItemRequest request = new GetItemRequest(tableName, key); if (config != null) { request.setConsistentRead(config.isConsistentRead()); if (config.getAttributesToGet() != null && config.getAttributesToGet().size() > 0) { request.setAttributesToGet(config.getAttributesToGet()); } } Table.appendDynamoDBDocumentUserAgentString(request); final GetItemResult response = this.client.getItem(request); final Map<String, AttributeValue> item = response.getItem(); if (item == null || item.size() == 0) { return null; } final Document returnDocument = fromAttributeMap(item); returnDocument.commit(); return returnDocument; }
/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * * @param attributesToGet * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a * href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public GetItemRequest withAttributesToGet(java.util.Collection<String> attributesToGet) { setAttributesToGet(attributesToGet); return this; }
public GetItemSpec withAttributesToGet(String ... attrNames) { if (attrNames == null) getRequest().setAttributesToGet(null); else getRequest().setAttributesToGet(Arrays.asList(attrNames)); return this; }
/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setAttributesToGet(java.util.Collection)} or {@link #withAttributesToGet(java.util.Collection)} if you * want to override the existing values. * </p> * * @param attributesToGet * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a * href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public GetItemRequest withAttributesToGet(String... attributesToGet) { if (this.attributesToGet == null) { setAttributesToGet(new java.util.ArrayList<String>(attributesToGet.length)); } for (String ele : attributesToGet) { this.attributesToGet.add(ele); } return this; }
/** * Makes a GetItemRequest for a given attribute. * @param attr Attribute name * @return GetItemRequest */ private GetItemRequest makeItemRequestFor(final String attr) { final GetItemRequest request = new GetItemRequest(); request.setTableName(this.name); request.setAttributesToGet(Collections.singletonList(attr)); request.setKey(this.attributes.only(this.keys)); request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); request.setConsistentRead(true); return request; }
/** * Makes a GetItemRequest for a given attribute. * @param attr Attribute name * @return GetItemRequest */ private GetItemRequest makeItemRequestFor(final String attr) { final GetItemRequest request = new GetItemRequest(); request.setTableName(this.name); request.setAttributesToGet(Collections.singletonList(attr)); request.setKey(this.attributes.only(this.keys)); request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); request.setConsistentRead(true); return request; }
public GetItemResult getItem(GetItemRequest request, IsolationLevel isolationLevel) { if (request.getAttributesToGet() != null) { Set<String> attributesToGet = new HashSet<String>(request.getAttributesToGet()); attributesToGet.addAll(Transaction.SPECIAL_ATTR_NAMES); request.setAttributesToGet(attributesToGet); } GetItemResult result = getClient().getItem(request); Map<String, AttributeValue> item = getReadIsolationHandler(isolationLevel).handleItem(result.getItem(), request.getAttributesToGet(), request.getTableName()); Transaction.stripSpecialAttributes(item); result.setItem(item); return result; }