当前位置: 首页>>代码示例>>Java>>正文


Java DeleteItemRequest类代码示例

本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.DeleteItemRequest的典型用法代码示例。如果您正苦于以下问题:Java DeleteItemRequest类的具体用法?Java DeleteItemRequest怎么用?Java DeleteItemRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DeleteItemRequest类属于com.amazonaws.services.dynamodbv2.model包,在下文中一共展示了DeleteItemRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteItem

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的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: createWorkersForDeletions

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的package包/类
private Collection<MutateWorker> createWorkersForDeletions(final StaticBuffer hashKey, final List<StaticBuffer> deletions, final DynamoDbStoreTransaction txh) {
    final List<MutateWorker> workers = new LinkedList<>();
    for (StaticBuffer rangeKey : deletions) {
        final Map<String, AttributeValue> keys = new ItemBuilder().hashKey(hashKey)
                                                                  .rangeKey(rangeKey)
                                                                  .build();

        final Expression updateExpression = new MultiUpdateExpressionBuilder(this, txh).hashKey(hashKey)
                                                                              .rangeKey(rangeKey)
                                                                              .build();

        final DeleteItemRequest request = super.createDeleteItemRequest().withKey(keys)
                 .withConditionExpression(updateExpression.getConditionExpression())
                 .withExpressionAttributeValues(updateExpression.getAttributeValues());


        workers.add(new DeleteItemWorker(request, client.getDelegate()));
    }
    return workers;
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:21,代码来源:DynamoDbStore.java

示例3: call

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的package包/类
@Override
public Void call() throws BackendException {

    final UpdateItem updateBackoff = new UpdateItem(updateItemRequest, dynamoDbDelegate);
    final UpdateItemResult result = updateBackoff.runWithBackoff();


    final Map<String, AttributeValue> item = result.getAttributes();

    if (item == null) {
        // bail
        return null;
    }

    // If the record has no Titan columns left after deletions occur, then just delete the record
    if (item.containsKey(Constants.JANUSGRAPH_HASH_KEY) && item.size() == ATTRIBUTES_IN_EMPTY_SINGLE_ITEM) {
        final DeleteItem deleteBackoff = new DeleteItem(new DeleteItemRequest().withTableName(updateItemRequest.getTableName())
                                                                         .withKey(updateItemRequest.getKey()), dynamoDbDelegate);
        deleteBackoff.runWithBackoff();
    }

    // void
    return null;
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:25,代码来源:SingleUpdateWithCleanupWorker.java

示例4: delete

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的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.DeleteItemRequest; //导入依赖的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.DeleteItemRequest; //导入依赖的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.DeleteItemRequest; //导入依赖的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.DeleteItemRequest; //导入依赖的package包/类
public CompletableFuture<DeleteItemResult> deleteItem(final DeleteItemRequest deleteItemRequest) {
    return asyncExecutor.execute(new Callable<DeleteItemResult>() {
        @Override
        public DeleteItemResult call() throws Exception {
            return dbExecutor.deleteItem(deleteItemRequest);
        }
    });
}
 
开发者ID:landawn,项目名称:AbacusUtil,代码行数:9,代码来源:AsyncDynamoDBExecutor.java

示例9: execute

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的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.DeleteItemRequest; //导入依赖的package包/类
public static void deleteItem(AmazonDynamoDBClient client, String tableName, String id) {
    java.util.Map<String, AttributeValue> key = new HashMap<String, AttributeValue>();
    key.put("Id", new AttributeValue().withN(id));

    DeleteItemRequest deleteItemRequest = new DeleteItemRequest()
        .withTableName(tableName)
        .withKey(key);
    client.deleteItem(deleteItemRequest);
}
 
开发者ID:gnethercutt,项目名称:dynamodb-streams-kafka,代码行数:10,代码来源:StreamAdapterDemoHelper.java

示例11: deleteUser

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的package包/类
/**
 * Deletes the specified username from the identity table.
 * 
 * @param username
 *            Unique user identifier
 * @throws DataAccessException
 */
public void deleteUser(String username) throws DataAccessException {
    HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>();
    key.put(ATTRIBUTE_USERNAME, new AttributeValue().withS(username));

    DeleteItemRequest deleteItemRequest = new DeleteItemRequest()
            .withTableName(USER_TABLE)
            .withKey(key);

    try {
        ddb.deleteItem(deleteItemRequest);
    } catch (AmazonClientException e) {
        throw new DataAccessException("Failed to delete user: " + username, e);
    }
}
 
开发者ID:awslabs,项目名称:amazon-cognito-developer-authentication-sample,代码行数:22,代码来源:UserAuthentication.java

示例12: deleteDevice

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的package包/类
/**
 * Deletes the specified UID from the identity table.
 * 
 * @param uid
 *            Unique device identifier
 */
public void deleteDevice(String uid) throws DataAccessException {
    HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>();
    key.put(ATTRIBUTE_UID, new AttributeValue().withS(uid));

    DeleteItemRequest deleteItemRequest = new DeleteItemRequest()
            .withTableName(DEVICE_TABLE)
            .withKey(key);

    try {
        ddb.deleteItem(deleteItemRequest);
    } catch (AmazonClientException e) {
        throw new DataAccessException("Failed to delete device: " + uid, e);
    }
}
 
开发者ID:awslabs,项目名称:amazon-cognito-developer-authentication-sample,代码行数:21,代码来源:DeviceAuthentication.java

示例13: deleteItem

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的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

示例14: deleteRow

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的package包/类
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);
	}
}
 
开发者ID:Erudika,项目名称:para,代码行数:13,代码来源:AWSDynamoDAO.java

示例15: deleteItem

import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest; //导入依赖的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


注:本文中的com.amazonaws.services.dynamodbv2.model.DeleteItemRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。