/** * Simplified method form for invoking the GetItem operation. * * @see #getItemAsync(GetItemRequest) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key)); }
/** * Simplified method form for invoking the GetItem operation with an AsyncHandler. * * @see #getItemAsync(GetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, com.amazonaws.handlers.AsyncHandler<GetItemRequest, GetItemResult> asyncHandler) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key), asyncHandler); }
/** * Simplified method form for invoking the GetItem operation. * * @see #getItemAsync(GetItemRequest) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key)); }
/** * Simplified method form for invoking the GetItem operation with an AsyncHandler. * * @see #getItemAsync(GetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, com.amazonaws.handlers.AsyncHandler<GetItemRequest, GetItemResult> asyncHandler) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key), asyncHandler); }
@Override public GetItemResult getItem(String tableName, java.util.Map<String, AttributeValue> key) { return getItem(new GetItemRequest().withTableName(tableName).withKey(key)); }
@Override public GetItemResult getItem(String tableName, java.util.Map<String, AttributeValue> key) { return getItem(new GetItemRequest().withTableName(tableName).withKey(key)); }
/** * Simplified method form for invoking the GetItem operation. * * @see #getItemAsync(GetItemRequest) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead)); }
/** * Simplified method form for invoking the GetItem operation. * * @see #getItemAsync(GetItemRequest) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead)); }
/** * Simplified method form for invoking the GetItem operation with an AsyncHandler. * * @see #getItemAsync(GetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead, com.amazonaws.handlers.AsyncHandler<GetItemRequest, GetItemResult> asyncHandler) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead), asyncHandler); }
/** * Simplified method form for invoking the GetItem operation with an AsyncHandler. * * @see #getItemAsync(GetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead, com.amazonaws.handlers.AsyncHandler<GetItemRequest, GetItemResult> asyncHandler) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead), asyncHandler); }
@Override public GetItemResult getItem(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead) { return getItem(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead)); }
@Override public GetItemResult getItem(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead) { return getItem(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead)); }
private GetItemOutcome doLoadItem(GetItemSpec spec) { String tableName = getTable().getTableName(); // Set up the key attributes GetItemRequest req = spec.getRequest() .withTableName(tableName) .withKey(InternalUtils.toAttributeValueMap(spec.getKeyComponents())) .withExpressionAttributeNames(spec.getNameMap()); GetItemResult result = getClient().getItem(req); return new GetItemOutcome(result); }
@Override public Optional<Map<String, Object>> getAttributes(RequestEnvelope envelope) throws PersistenceException { String partitionKey = partitionKeyGenerator.apply(envelope); GetItemRequest request = new GetItemRequest() .withTableName(tableName) .withKey(Collections.singletonMap(partitionKeyName, new AttributeValue().withS(partitionKey))) .withConsistentRead(true); Map<String, AttributeValue> result = null; try { result = dynamoDb.getItem(request).getItem(); } catch (ResourceNotFoundException e) { throw new PersistenceException(String.format("Table %s does not exist or is in the process of being created", tableName), e); } catch (AmazonDynamoDBException e) { throw new PersistenceException("Failed to retrieve attributes from DynamoDB", e); } if (result != null && result.containsKey(attributesKeyName)) { Map<String, Object> attributes = ItemUtils.toSimpleMapValue(result.get(attributesKeyName).getM()); return Optional.of(attributes); } return Optional.empty(); }
@Override public <T> T getConfig(String project, String configName, Class<T> clazz) { Map<String, AttributeValue> item = dynamoDBClient.getItem(new GetItemRequest() .withTableName(tableConfig.getTableName()) .withKey(new SimpleImmutableEntry<>("project", new AttributeValue(project)), new SimpleImmutableEntry<>("id", new AttributeValue(configName))) .withAttributesToGet("value") .withConsistentRead(true)).getItem(); if (item == null) { return null; } String value = item.get("value").getS(); return value == null ? null : JsonHelper.read(value, clazz); }
@Override public MaterializedView getMaterializedView(String project, String tableName) { Map<String, AttributeValue> item = dynamoDBClient.getItem(new GetItemRequest().withTableName(tableConfig.getTableName()) .withAttributesToGet("value") .withKey(of( "project", new AttributeValue(project), "type_table_name", new AttributeValue("materialized_" + tableName)))).getItem(); if (item == null) { throw new NotExistsException("Materialized view"); } return JsonHelper.read(item.get("value").getS(), MaterializedView.class); }
/** * Simplified method form for invoking the GetItem operation with an AsyncHandler. * * @see #getItemAsync(GetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, com.amazonaws.handlers.AsyncHandler<GetItemRequest, GetItemResult> asyncHandler) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key), asyncHandler); }
/** * Simplified method form for invoking the GetItem operation with an AsyncHandler. * * @see #getItemAsync(GetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, com.amazonaws.handlers.AsyncHandler<GetItemRequest, GetItemResult> asyncHandler) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key), asyncHandler); }
/** * Simplified method form for invoking the GetItem operation. * * @see #getItemAsync(GetItemRequest) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead)); }
/** * Simplified method form for invoking the GetItem operation. * * @see #getItemAsync(GetItemRequest) */ @Override public java.util.concurrent.Future<GetItemResult> getItemAsync(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead)); }