本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.DeleteItemResult类的典型用法代码示例。如果您正苦于以下问题:Java DeleteItemResult类的具体用法?Java DeleteItemResult怎么用?Java DeleteItemResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeleteItemResult类属于com.amazonaws.services.dynamodbv2.model包,在下文中一共展示了DeleteItemResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deleteItem
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
DeleteItemResult deleteItem(final DeleteItemRequest request) throws BackendException {
setUserAgent(request);
DeleteItemResult result;
final int wcu = estimateCapacityUnits(DELETE_ITEM, request.getTableName());
timedWriteThrottle(DELETE_ITEM, request.getTableName(), wcu);
final Timer.Context apiTimerContext = getTimerContext(DELETE_ITEM, request.getTableName());
try {
result = client.deleteItem(request);
} catch (Exception e) {
throw processDynamoDbApiException(e, DELETE_ITEM, request.getTableName());
} finally {
apiTimerContext.stop();
}
meterConsumedCapacity(DELETE_ITEM, result.getConsumedCapacity());
return result;
}
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:19,代码来源:DynamoDbDelegate.java
示例2: test_deleteItem_WithAllParameters
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
@Test
public void test_deleteItem_WithAllParameters() throws Exception {
createTable();
putItem(TEST_ATTRIBUTE, TEST_ATTRIBUTE_VALUE);
Map<String, AttributeValue> key = new HashMap<String, AttributeValue>();
key.put(TEST_ATTRIBUTE, new AttributeValue()
.withS(TEST_ATTRIBUTE_VALUE));
String returnValues = "";
DeleteItemResult deleteResult = dynamoDb.deleteItem(TEST_TABLE_NAME, key, returnValues);
AttributeValue attributeValue = deleteResult.getAttributes().get(TEST_ATTRIBUTE);
GetItemResult getResult = getItem(TEST_ATTRIBUTE, TEST_ATTRIBUTE_VALUE);
assertThat(attributeValue.getS(), equalTo(TEST_ATTRIBUTE_VALUE));
assertThat(getResult, nullValue());
}
开发者ID:bizo,项目名称:aws-java-sdk-stubs,代码行数:19,代码来源:AmazonDynamoDBStubTest.java
示例3: deleteEntityByUniqueId
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
/**
* The deleteEntityByUniqueId method deletes an item from a table.
*
* @param uniqueId
* @return
*/
@Override
public boolean deleteEntityByUniqueId(String tableName, String uniqueId) {
if (StringUtils.isEmpty(uniqueId)) {
return false;
}
HashMap<String, AttributeValue> primaryKey = new HashMap<String, AttributeValue> ();
primaryKey.put(AttributeKey.UUID, new AttributeValue().withS(uniqueId));
DeleteItemResult deleteItemResult = dynamoDBService.deleteItem(tableName, primaryKey);
if (deleteItemResult != null) {
return true;
}
return false;
}
开发者ID:dgks0n,项目名称:milton-aws,代码行数:22,代码来源:DynamoDBManagerImpl.java
示例4: delete
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
@Override
public <T extends Message> boolean delete(T item, Modifier... modifiers) throws DataStoreException {
DynamoClassMapping<T> tableInfo = getClassMapping(item);
log.debug("Delete {}", item);
for (Modifier modifier : modifiers) {
throw new UnsupportedOperationException();
}
DeleteItemRequest request = new DeleteItemRequest();
request.setTableName(tableInfo.getDynamoTableName());
request.setKey(tableInfo.buildCompleteKey(item));
request.setConditionExpression("attribute_exists(hash_key)");
try {
DeleteItemResult response = dynamoDB.deleteItem(request);
return true;
} catch (ConditionalCheckFailedException e) {
return false;
}
}
开发者ID:justinsb,项目名称:cloudata,代码行数:22,代码来源:DynamodbDataStore.java
示例5: deletePoint
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
public DeletePointResult deletePoint(DeletePointRequest deletePointRequest) {
long geohash = S2Manager.generateGeohash(deletePointRequest.getGeoPoint());
long hashKey = S2Manager.generateHashKey(geohash, config.getHashKeyLength());
DeleteItemRequest deleteItemRequest = deletePointRequest.getDeleteItemRequest();
deleteItemRequest.setTableName(config.getTableName());
AttributeValue hashKeyValue = new AttributeValue().withN(String.valueOf(hashKey));
deleteItemRequest.getKey().put(config.getHashKeyAttributeName(), hashKeyValue);
deleteItemRequest.getKey().put(config.getRangeKeyAttributeName(), deletePointRequest.getRangeKeyValue());
DeleteItemResult deleteItemResult = config.getDynamoDBClient().deleteItem(deleteItemRequest);
DeletePointResult deletePointResult = new DeletePointResult(deleteItemResult);
return deletePointResult;
}
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:18,代码来源:DynamoDBManager.java
示例6: delete
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
/**
* Delete.
*
* @param ticketId the ticket id
* @return the boolean
*/
public boolean delete(final String ticketId) {
final TicketDefinition metadata = this.ticketCatalog.find(ticketId);
if (metadata != null) {
final DeleteItemRequest del = new DeleteItemRequest()
.withTableName(metadata.getProperties().getStorageName())
.withKey(Collections.singletonMap(ColumnNames.ID.getName(), new AttributeValue(ticketId)));
LOGGER.debug("Submitting delete request [{}] for ticket [{}]", del, ticketId);
final DeleteItemResult res = amazonDynamoDBClient.deleteItem(del);
LOGGER.debug("Delete request came back with result [{}]", res);
return res != null;
}
return false;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:21,代码来源:DynamoDbTicketRegistryFacilitator.java
示例7: delete
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
/**
* Delete boolean.
*
* @param service the service
* @return the boolean
*/
public boolean delete(final RegisteredService service) {
final DeleteItemRequest del = new DeleteItemRequest()
.withTableName(TABLE_NAME)
.withKey(Collections.singletonMap(ColumnNames.ID.getName(), new AttributeValue(String.valueOf(service.getId()))));
LOGGER.debug("Submitting delete request [{}] for service [{}]", del, service);
final DeleteItemResult res = amazonDynamoDBClient.deleteItem(del);
LOGGER.debug("Delete request came back with result [{}]", res);
return res != null;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:18,代码来源:DynamoDbServiceRegistryFacilitator.java
示例8: deleteItem
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
public CompletableFuture<DeleteItemResult> deleteItem(final String tableName, final Map<String, AttributeValue> key) {
return asyncExecutor.execute(new Callable<DeleteItemResult>() {
@Override
public DeleteItemResult call() throws Exception {
return dbExecutor.deleteItem(tableName, key);
}
});
}
开发者ID:landawn,项目名称:AbacusUtil,代码行数:9,代码来源:AsyncDynamoDBExecutor.java
示例9: execute
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
@Override
public void execute() {
DeleteItemResult result = ddbClient.deleteItem(new DeleteItemRequest()
.withTableName(determineTableName())
.withKey(determineKey())
.withReturnValues(determineReturnValues())
.withExpected(determineUpdateCondition()));
addAttributesToResult(result.getAttributes());
}
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:DeleteItemCommand.java
示例10: deleteItem
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
@Override
public DeleteItemResult deleteItem(String tableName, HashMap<String, AttributeValue> primaryKey) {
DeleteItemRequest deleteItemRequest = new DeleteItemRequest()
.withTableName(tableName)
.withKey(primaryKey);
DeleteItemResult deleteItemResult = dynamoDBClient.deleteItem(deleteItemRequest);
LOG.info("Successful by deleting item in " + tableName);
return deleteItemResult;
}
开发者ID:dgks0n,项目名称:milton-aws,代码行数:11,代码来源:DynamoDBServiceImpl.java
示例11: deleteItem
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
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);
}
}
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:31,代码来源:LowLevelItemCRUDExample.java
示例12: remove
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
@Override
@SuppressWarnings("PMD.UseConcurrentHashMap")
public void remove() {
synchronized (this.dosage) {
final AmazonDynamoDB aws = this.credentials.aws();
try {
final Dosage prev = this.dosage.get();
final List<Map<String, AttributeValue>> items =
new ArrayList<Map<String, AttributeValue>>(prev.items());
final Map<String, AttributeValue> item =
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()
)
);
this.dosage.set(new AwsIterator.Fixed(prev, items));
--this.position;
Logger.info(
this,
"#remove(): item #%d removed from DynamoDB, %s, in %[ms]s",
this.position,
new PrintableConsumedCapacity(
res.getConsumedCapacity()
).print(),
System.currentTimeMillis() - start
);
} finally {
aws.shutdown();
}
}
}
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:40,代码来源:AwsIterator.java
示例13: delete
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
@Override
public void delete(final Map<String, AttributeValue> attributes)
throws IOException {
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(
this,
"#delete('%[text]s'): deleted item in '%s', %s, in %[ms]s",
attributes, this.self,
new PrintableConsumedCapacity(
result.getConsumedCapacity()
).print(),
System.currentTimeMillis() - start
);
} catch (final AmazonClientException ex) {
throw new IOException(
String.format(
"failed to delete at \"%s\" by keys %s",
this.self, attributes
),
ex
);
} finally {
aws.shutdown();
}
}
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:34,代码来源:AwsTable.java
示例14: deleteItem
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
public DeleteItemResult deleteItem(final String tableName, final Map<String, AttributeValue> key) {
return dynamoDB.deleteItem(tableName, key);
}
开发者ID:landawn,项目名称:AbacusUtil,代码行数:4,代码来源:DynamoDBExecutor.java
示例15: deleteItem
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
@Override
public DeleteItemResult deleteItem(DeleteItemRequest deleteItemRequest) {
this.deleteItemRequest = deleteItemRequest;
return new DeleteItemResult().withAttributes(getAttributes());
}
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:AmazonDDBClientMock.java
示例16: call
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
@Override
protected DeleteItemResult call() throws BackendException {
return delegate.deleteItem(request);
}
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:5,代码来源:ExponentialBackoff.java
示例17: deletesItemFromDynamo
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
/**
* AwsTable can delete an item.
* @throws Exception If some problem inside
*/
@Test
public void deletesItemFromDynamo() throws Exception {
final Credentials credentials = Mockito.mock(Credentials.class);
final AmazonDynamoDB aws = Mockito.mock(AmazonDynamoDB.class);
Mockito.doReturn(aws).when(credentials).aws();
Mockito.doReturn(
new DeleteItemResult().withConsumedCapacity(
new ConsumedCapacity().withCapacityUnits(1.0d)
)
).when(aws).deleteItem(Mockito.any(DeleteItemRequest.class));
Mockito.doReturn(
new DescribeTableResult().withTable(
new TableDescription().withKeySchema(
new KeySchemaElement().withAttributeName(AwsTableTest.KEY)
)
)
).when(aws).describeTable(Mockito.any(DescribeTableRequest.class));
final String attr = "attribute-2";
final AttributeValue value = new AttributeValue("value-2");
final String name = "table-name-2";
final Table table = new AwsTable(
credentials, Mockito.mock(Region.class), name
);
table.delete(new Attributes().with(attr, value));
Mockito.verify(aws).deleteItem(
DeleteItemRequest.class.cast(
MockitoHamcrest.argThat(
Matchers.allOf(
Matchers.hasProperty(
AwsTableTest.TABLE_NAME,
Matchers.equalTo(name)
),
Matchers.hasProperty(
AwsTableTest.KEY,
Matchers.hasEntry(
Matchers.equalTo(attr),
Matchers.equalTo(value)
)
)
)
)
)
);
}
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:49,代码来源:AwsTableTest.java
示例18: DeletePointResult
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
public DeletePointResult(DeleteItemResult deleteItemResult) {
this.deleteItemResult = deleteItemResult;
}
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:4,代码来源:DeletePointResult.java
示例19: getDeleteItemResult
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
public DeleteItemResult getDeleteItemResult() {
return deleteItemResult;
}
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:4,代码来源:DeletePointResult.java
示例20: deleteItem
import com.amazonaws.services.dynamodbv2.model.DeleteItemResult; //导入依赖的package包/类
/**
* Deletes a single item in a table by primary key
*
* You can perform a conditional delete operation that deletes the item if
* it exists, or if it has an expected attribute value.
*
* @param tableName
* - The name of the table
* @param primaryKey
* - The primary key of the item
* @return
*/
DeleteItemResult deleteItem(String tableName,
HashMap<String, AttributeValue> primaryKey);
开发者ID:dgks0n,项目名称:milton-aws,代码行数:15,代码来源:DynamoDBService.java
注:本文中的com.amazonaws.services.dynamodbv2.model.DeleteItemResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论