Refine search
/** * Simplified method form for invoking the DeleteItem operation with an AsyncHandler. * * @see #deleteItemAsync(DeleteItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<DeleteItemResult> deleteItemAsync(String tableName, java.util.Map<String, AttributeValue> key, com.amazonaws.handlers.AsyncHandler<DeleteItemRequest, DeleteItemResult> asyncHandler) { return deleteItemAsync(new DeleteItemRequest().withTableName(tableName).withKey(key), asyncHandler); }
setTableName(tableName); setKey(key); setReturnValues(returnValues);
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode()); hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode()); hashCode = prime * hashCode + ((getExpected() == null) ? 0 : getExpected().hashCode()); hashCode = prime * hashCode + ((getConditionalOperator() == null) ? 0 : getConditionalOperator().hashCode()); hashCode = prime * hashCode + ((getReturnValues() == null) ? 0 : getReturnValues().hashCode()); hashCode = prime * hashCode + ((getReturnConsumedCapacity() == null) ? 0 : getReturnConsumedCapacity().hashCode()); hashCode = prime * hashCode + ((getReturnItemCollectionMetrics() == null) ? 0 : getReturnItemCollectionMetrics().hashCode()); hashCode = prime * hashCode + ((getConditionExpression() == null) ? 0 : getConditionExpression().hashCode()); hashCode = prime * hashCode + ((getExpressionAttributeNames() == null) ? 0 : getExpressionAttributeNames().hashCode()); hashCode = prime * hashCode + ((getExpressionAttributeValues() == null) ? 0 : getExpressionAttributeValues().hashCode()); return hashCode; }
/** * Constructs a new DeleteItemRequest object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param tableName * The name of the table from which to delete the item. * @param key * A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item * to delete.</p> * <p> * For the primary key, you must provide all of the attributes. For example, with a simple primary key, you * only need to provide a value for the partition key. For a composite primary key, you must provide values * for both the partition key and the sort key. */ public DeleteItemRequest(String tableName, java.util.Map<String, AttributeValue> key) { setTableName(tableName); setKey(key); }
/** * Simplified method form for invoking the DeleteItem operation with an AsyncHandler. * * @see #deleteItemAsync(DeleteItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<DeleteItemResult> deleteItemAsync(String tableName, java.util.Map<String, AttributeValue> key, String returnValues, com.amazonaws.handlers.AsyncHandler<DeleteItemRequest, DeleteItemResult> asyncHandler) { return deleteItemAsync(new DeleteItemRequest().withTableName(tableName).withKey(key).withReturnValues(returnValues), asyncHandler); }
public void removeState(final String streamName, final String applicationName, final String namespace, final String shardId) throws Exception { DeleteItemRequest req = new DeleteItemRequest().withTableName(TABLE_NAME).withKey( getKey(streamName, applicationName, namespace, shardId)); dynamoClient.deleteItem(req); }
DeleteItemRequest req = new DeleteItemRequest().withKey(key) .withTableName(tableName).withExpected(internalAssertions) .withRequestMetricCollector(config.getRequestMetricCollector()); .withConditionExpression(conditionalExpression) .withExpressionAttributeNames( deleteExpression.getExpressionAttributeNames()) .withExpressionAttributeValues( deleteExpression.getExpressionAttributeValues()); req = req.withExpected( mergeExpectedAttributeValueConditions(internalAssertions, deleteExpression.getExpected(), deleteExpression.getConditionalOperator())) .withConditionalOperator( deleteExpression.getConditionalOperator()); db.deleteItem(applyUserAgent(req));
items.remove(this.position); final long start = System.currentTimeMillis(); final DeleteItemResult res = aws.deleteItem( new DeleteItemRequest() .withTableName(this.name) .withKey(new Attributes(item).only(this.keys)) .withReturnConsumedCapacity( ReturnConsumedCapacity.TOTAL .withExpected( new Attributes(item).only(this.keys).asKeys() ); } finally { aws.shutdown();
final AmazonDynamoDB aws = this.credentials.aws(); try { final DeleteItemRequest request = new DeleteItemRequest(); request.setTableName(this.self); request.setKey(attributes); request.setReturnValues(ReturnValue.NONE); request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); final DeleteItemResult result = aws.deleteItem(request); final long start = System.currentTimeMillis(); Logger.info( ); } finally { aws.shutdown();
/** * {@inheritDoc} */ public void deleteAll() throws DependencyException, InvalidStateException, ProvisionedThroughputException { List<T> allLeases = listLeases(); LOG.warn("Deleting " + allLeases.size() + " items from table " + table); for (T lease : allLeases) { DeleteItemRequest deleteRequest = new DeleteItemRequest(); deleteRequest.setTableName(table); deleteRequest.setKey(serializer.getDynamoHashKey(lease)); dynamoDBClient.deleteItem(deleteRequest); } }
private DeleteItemOutcome doDeleteItem(DeleteItemSpec spec) { // set the table name final String tableName = getTable().getTableName(); // set up the keys DeleteItemRequest req = spec.getRequest().withTableName(tableName) .withKey(InternalUtils.toAttributeValueMap(spec.getKeyComponents())); // set up the expected attribute map, if any final Collection<Expected> expected = spec.getExpected(); final Map<String, ExpectedAttributeValue> expectedMap = InternalUtils.toExpectedAttributeValueMap(expected); // set up the value map, if any (when expression API is used) final Map<String,AttributeValue> attrValMap = InternalUtils.fromSimpleMap(spec.getValueMap()); // set up the request req.withExpected(expectedMap) .withExpressionAttributeNames(spec.getNameMap()) .withExpressionAttributeValues(attrValMap) ; DeleteItemResult result = getClient().deleteItem(req); return new DeleteItemOutcome(result); }
private static void deleteItem() { try { HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>(); key.put("Id", new AttributeValue().withN("120")); Map<String, AttributeValue> expressionAttributeValues = new HashMap<String, AttributeValue>(); expressionAttributeValues.put(":val", new AttributeValue().withBOOL(false)); ReturnValue returnValues = ReturnValue.ALL_OLD; DeleteItemRequest deleteItemRequest = new DeleteItemRequest() .withTableName(tableName) .withKey(key) .withConditionExpression("InPublication = :val") .withExpressionAttributeValues(expressionAttributeValues) .withReturnValues(returnValues); DeleteItemResult result = client.deleteItem(deleteItemRequest); // Check the response. System.out.println("Printing item that was deleted..."); printItem(result.getAttributes()); } catch (AmazonServiceException ase) { System.err.println("Failed to get item after deletion " + tableName); } }
String returnValues) throws AmazonServiceException, AmazonClientException { DeleteItemRequest deleteItemRequest = new DeleteItemRequest(); deleteItemRequest.setTableName(tableName); deleteItemRequest.setKey(key); deleteItemRequest.setReturnValues(returnValues); return deleteItem(deleteItemRequest);
DeleteItemRequest deleteItemRequest = new DeleteItemRequest(); deleteItemRequest.setTableName(tableName); deleteItemRequest.setKey(key); return deleteItem(deleteItemRequest);
public DeleteItemSpec() { super(new DeleteItemRequest()); }
private Document deleteItem(Key key, DeleteItemOperationConfig config) { final DeleteItemRequest request = new DeleteItemRequest(tableName, key); if (config != null) { request.setReturnValues(config.getReturnValue()); } Table.appendDynamoDBDocumentUserAgentString(request); final DeleteItemResult result = this.client.deleteItem(request); final Document returnDocument = this.fromAttributeMap(result.getAttributes()); returnDocument.commit(); return returnDocument; }
private void deleteRow(String key, String appid) { if (StringUtils.isBlank(key) || StringUtils.isBlank(appid)) { return; } try { DeleteItemRequest delItemRequest = new DeleteItemRequest(getTableNameForAppid(appid), Collections.singletonMap(Config._KEY, new AttributeValue(getKeyForAppid(key, appid)))); client().deleteItem(delItemRequest); } catch (Exception e) { logger.error("Could not delete row from DB - appid={}, key={}", appid, key, e); throwIfNecessary(e); } }
@Override public void dropProjectIfExists(String project) { dynamoDBClient.deleteItem(new DeleteItemRequest() .withKey(ImmutableMap.of("project", new AttributeValue(project)))); }
protected DeleteItemRequest createDeleteItemRequest() { return new DeleteItemRequest() .withTableName(tableName) .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); }
public DeletePointRequest(GeoPoint geoPoint, AttributeValue rangeKeyValue) { deleteItemRequest = new DeleteItemRequest(); deleteItemRequest.setKey(new HashMap<String, AttributeValue>()); this.geoPoint = geoPoint; this.rangeKeyValue = rangeKeyValue; }