• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UpdateItemRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testCreateEntryAlreadyExists

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
@Test
public void testCreateEntryAlreadyExists() throws Exception {
    RawSecretEntry rawSecretEntry = constructRawEntry(SECRET_NAME);
    UpdateItemRequest expectedUpdateRequest = constructUpdateItemRequest(rawSecretEntry, false, Optional.empty());

    // Already exists will cause a check failed exception.
    when(mockDynamoDBClient.updateItem(expectedUpdateRequest)).thenThrow(
            new ConditionalCheckFailedException(""));

    boolean exceptionThrown = false;
    try {
        dynamoDB.create(rawSecretEntry);
    } catch (AlreadyExistsException e) {
        assertEquals(e.getMessage(), "DynamoDB store entry already exists:{1={S: secret1,}, 2={N: 1,}}");
        exceptionThrown = true;
    }
    assertTrue(exceptionThrown);
    verify(mockDynamoDBClient, times(1)).updateItem(expectedUpdateRequest);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:20,代码来源:GenericDynamoDBTest.java


示例2: testUpdateEntryDoesNotExist

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
@Test
public void testUpdateEntryDoesNotExist() throws Exception {
    RawSecretEntry rawSecretEntry = constructRawEntry(SECRET_NAME);
    RawSecretEntry alternativeRawSecretEntry = constructAlternativeRawSecretEntry(SECRET_NAME);

    UpdateItemRequest expectedUpdateRequest = constructUpdateItemRequest(rawSecretEntry, true, Optional.of(alternativeRawSecretEntry));

    when(mockDynamoDBClient.updateItem(expectedUpdateRequest)).thenThrow(
            new ConditionalCheckFailedException(""));

    boolean exceptionThrown = false;
    try {
        dynamoDB.update(rawSecretEntry, alternativeRawSecretEntry);
    } catch (DoesNotExistException e) {
        assertEquals(e.getMessage(), "Precondition to update entry in DynamoDB failed:{1={S: secret1,}, 2={N: 1,}}");
        exceptionThrown = true;
    }
    assertTrue(exceptionThrown);

    // Check all the expected calls to AWS were made.
    verify(mockDynamoDBClient, times(1)).updateItem(expectedUpdateRequest);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:23,代码来源:GenericDynamoDBTest.java


示例3: updateItem

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
UpdateItemResult updateItem(final UpdateItemRequest request) throws BackendException {
    setUserAgent(request);
    UpdateItemResult result;
    final int bytes;
    if (request.getUpdateExpression() != null) {
        bytes = calculateExpressionBasedUpdateSize(request);
    } else {
        bytes = calculateItemUpdateSizeInBytes(request.getAttributeUpdates());
    }
    getBytesHistogram(UPDATE_ITEM, request.getTableName()).update(bytes);
    final int wcu = computeWcu(bytes);
    timedWriteThrottle(UPDATE_ITEM, request.getTableName(), wcu);

    final Timer.Context apiTimerContext = getTimerContext(UPDATE_ITEM, request.getTableName());
    try {
        result = client.updateItem(request);
    } catch (Exception e) {
        throw processDynamoDbApiException(e, UPDATE_ITEM, request.getTableName());
    } finally {
        apiTimerContext.stop();
    }
    meterConsumedCapacity(UPDATE_ITEM, result.getConsumedCapacity());

    return result;
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:26,代码来源:DynamoDbDelegate.java


示例4: updateItem

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
public static void updateItem(AmazonDynamoDBClient client, String tableName, String id, String val) {
    java.util.Map<String, AttributeValue> key = new HashMap<String, AttributeValue>();
    key.put("Id", new AttributeValue().withN(id));

    Map<String, AttributeValueUpdate> attributeUpdates = new HashMap<String, AttributeValueUpdate>();
    AttributeValueUpdate update = new AttributeValueUpdate()
        .withAction(AttributeAction.PUT)
        .withValue(new AttributeValue().withS(val));
    attributeUpdates.put("attribute-2", update);

    UpdateItemRequest updateItemRequest = new UpdateItemRequest()
        .withTableName(tableName)
        .withKey(key)
        .withAttributeUpdates(attributeUpdates);
    client.updateItem(updateItemRequest);
}
 
开发者ID:gnethercutt,项目名称:dynamodb-streams-kafka,代码行数:17,代码来源:StreamAdapterDemoHelper.java


示例5: sendUpdateRequest

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
/**
 * Sends an update request to the service and returns true if the request is successful.
 */
public boolean sendUpdateRequest(Map<String, AttributeValue> primaryKey, Map<String, AttributeValueUpdate> updateItems,
        Map<String, ExpectedAttributeValue> expectedItems) throws Exception {
    if (updateItems.isEmpty()) {
        return false; // No update, return false
    }
    UpdateItemRequest updateItemRequest = new UpdateItemRequest().withTableName(tableName).withKey(primaryKey).withReturnValues(ReturnValue.UPDATED_NEW)
            .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withAttributeUpdates(updateItems);
    if (expectedItems != null) {
        updateItemRequest.withExpected(expectedItems);
    }

    UpdateItemResult result = dynamoDBClient.updateItem(updateItemRequest);
    if(!isRunningOnDDBLocal) {
        // DDB Local does not support rate limiting
        tableWriteRateLimiter.adjustRateWithConsumedCapacity(result.getConsumedCapacity());
    }
    return true;
}
 
开发者ID:awslabs,项目名称:dynamodb-online-index-violation-detector,代码行数:22,代码来源:TableWriter.java


示例6: updateRow

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
private void updateRow(String key, String appid, Map<String, AttributeValue> row) {
	if (StringUtils.isBlank(key) || StringUtils.isBlank(appid) || row == null || row.isEmpty()) {
		return;
	}
	Map<String, AttributeValueUpdate> rou = new HashMap<>();
	try {
		for (Entry<String, AttributeValue> attr : row.entrySet()) {
			rou.put(attr.getKey(), new AttributeValueUpdate(attr.getValue(), AttributeAction.PUT));
		}
		UpdateItemRequest updateItemRequest = new UpdateItemRequest(getTableNameForAppid(appid),
				Collections.singletonMap(Config._KEY, new AttributeValue(getKeyForAppid(key, appid))), rou);
		client().updateItem(updateItemRequest);
	} catch (Exception e) {
		logger.error("Could not update row in DB - appid={}, key={}", appid, key, e);
	}
}
 
开发者ID:Erudika,项目名称:para,代码行数:17,代码来源:AWSDynamoDAO.java


示例7: updatePoint

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
public UpdatePointResult updatePoint(UpdatePointRequest updatePointRequest) {
	long geohash = S2Manager.generateGeohash(updatePointRequest.getGeoPoint());
	long hashKey = S2Manager.generateHashKey(geohash, config.getHashKeyLength());

	UpdateItemRequest updateItemRequest = updatePointRequest.getUpdateItemRequest();
	updateItemRequest.setTableName(config.getTableName());

	AttributeValue hashKeyValue = new AttributeValue().withN(String.valueOf(hashKey));
	updateItemRequest.getKey().put(config.getHashKeyAttributeName(), hashKeyValue);
	updateItemRequest.getKey().put(config.getRangeKeyAttributeName(), updatePointRequest.getRangeKeyValue());

	// Geohash and geoJson cannot be updated.
	updateItemRequest.getAttributeUpdates().remove(config.getGeohashAttributeName());
	updateItemRequest.getAttributeUpdates().remove(config.getGeoJsonAttributeName());

	UpdateItemResult updateItemResult = config.getDynamoDBClient().updateItem(updateItemRequest);
	UpdatePointResult updatePointResult = new UpdatePointResult(updateItemResult);

	return updatePointResult;
}
 
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:21,代码来源:DynamoDBManager.java


示例8: executeUpdate

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
private void executeUpdate(Map<String, AttributeValue> keys, Map<String, AttributeValueUpdate> attributes, Map<String, ExpectedAttributeValue> expected) {
    UpdateItemRequest updateEntry = new UpdateItemRequest()
            .withTableName(tableName)
            .withKey(keys)
            .withAttributeUpdates(attributes)
            .withExpected(expected);

    client.updateItem(updateEntry);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:10,代码来源:GenericDynamoDB.java


示例9: testCreateEntry

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
@Test
public void testCreateEntry() throws Exception {
    RawSecretEntry rawSecretEntry =  constructRawEntry(SECRET_NAME);
    UpdateItemRequest expectedUpdateRequest = constructUpdateItemRequest(rawSecretEntry, false, Optional.empty());

    dynamoDB.create(rawSecretEntry);
    verify(mockDynamoDBClient, times(1)).updateItem(expectedUpdateRequest);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:9,代码来源:GenericDynamoDBTest.java


示例10: testUpdateEntry

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
@Test
public void testUpdateEntry() throws Exception {
    RawSecretEntry rawSecretEntry = constructRawEntry(SECRET_NAME);
    RawSecretEntry alternativeRawSecretEntry = constructAlternativeRawSecretEntry(SECRET_NAME);

    UpdateItemRequest expectedUpdateRequest = constructUpdateItemRequest(rawSecretEntry, true, Optional.of(alternativeRawSecretEntry));

    dynamoDB.update(rawSecretEntry, alternativeRawSecretEntry);
    verify(mockDynamoDBClient, times(1)).updateItem(expectedUpdateRequest);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:11,代码来源:GenericDynamoDBTest.java


示例11: updateItem

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


示例12: execute

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
@Override
public void execute() {
    UpdateItemResult result = ddbClient.updateItem(new UpdateItemRequest()
            .withTableName(determineTableName())
            .withKey(determineKey())
            .withAttributeUpdates(determineUpdateValues())
            .withExpected(determineUpdateCondition())
            .withReturnValues(determineReturnValues()));

    addAttributesToResult(result.getAttributes());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:UpdateItemCommand.java


示例13: calculateExpressionBasedUpdateSize

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
/**
 * This method calculates a lower bound of the size of a new item created with UpdateItem UpdateExpression. It does not
 * account for the size of the attribute names of the document paths in the attribute names map and it assumes that the
 * UpdateExpression only uses the SET action to assign to top-level attributes.
 * @param request UpdateItem request that uses update expressions
 * @return the size of the post-update image of the item
 */
private int calculateExpressionBasedUpdateSize(final UpdateItemRequest request) {
    if (request == null || request.getUpdateExpression() == null) {
        throw new IllegalArgumentException("request did not use update expression");
    }
    int size = calculateItemSizeInBytes(request.getKey());
    for (AttributeValue value : request.getExpressionAttributeValues().values()) {
        size += calculateAttributeSizeInBytes(value);
    }
    return size;
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:18,代码来源:DynamoDbDelegate.java


示例14: createMutationWorkers

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
@Override
public Collection<MutateWorker> createMutationWorkers(final Map<StaticBuffer, KCVMutation> mutationMap, final DynamoDbStoreTransaction txh) {

    final List<MutateWorker> workers = Lists.newLinkedList();

    for (Map.Entry<StaticBuffer, KCVMutation> entry : mutationMap.entrySet()) {
        final StaticBuffer hashKey = entry.getKey();
        final KCVMutation mutation = entry.getValue();

        final Map<String, AttributeValue> key = new ItemBuilder().hashKey(hashKey)
                                                           .build();

        // Using ExpectedAttributeValue map to handle large mutations in a single request
        // Large mutations would require multiple requests using expressions
        final Map<String, ExpectedAttributeValue> expected =
            new SingleExpectedAttributeValueBuilder(this, txh, hashKey).build(mutation);

        final Map<String, AttributeValueUpdate> attributeValueUpdates =
            new SingleUpdateBuilder().deletions(mutation.getDeletions())
                .additions(mutation.getAdditions())
                .build();

        final UpdateItemRequest request = super.createUpdateItemRequest()
               .withKey(key)
               .withReturnValues(ReturnValue.ALL_NEW)
               .withAttributeUpdates(attributeValueUpdates)
               .withExpected(expected);

        final MutateWorker worker;
        if (mutation.hasDeletions() && !mutation.hasAdditions()) {
            worker = new SingleUpdateWithCleanupWorker(request, client.getDelegate());
        } else {
            worker = new UpdateItemWorker(request, client.getDelegate());
        }
        workers.add(worker);
    }
    return workers;
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:39,代码来源:DynamoDbSingleRowStore.java


示例15: handleRequest

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
@Override
public Object handleRequest(Object input, Context context) {
	context.getLogger().log("input: " + input);
	if (input.toString().equals("{}") || input.toString().equals("")) {
		context.getLogger().log("input is empty: abort");
		return "{\"status\":\"error\",\"message\":\"input at lambda function is empty\"}";
	}

	dynamoDB = new AmazonDynamoDBClient().withRegion(Region
			.getRegion(Regions.EU_WEST_1));

	HashMap<String, String> mapInput = (HashMap<String, String>) input;
	Map<String, AttributeValue> employeeKey = new HashMap<String, AttributeValue>();
	String employeeId = mapInput.get("employee_id");
	context.getLogger().log("employee_id: " + employeeId);
	employeeKey.put("employee_id", new AttributeValue().withS(employeeId));
	Map<String, AttributeValueUpdate> attributeUpdates = new HashMap<String, AttributeValueUpdate>();
	attributeUpdates.put("approval", new AttributeValueUpdate()
			.withValue(new AttributeValue().withS("approved")));
	UpdateItemRequest updateItemRequest = new UpdateItemRequest()
			.withKey(employeeKey).withAttributeUpdates(attributeUpdates)
			.withTableName("lambda-reimbursment");
	UpdateItemResult updateItemResult = dynamoDB
			.updateItem(updateItemRequest);
	context.getLogger().log("Result: " + updateItemResult);

	return "{'status':'done'}";
}
 
开发者ID:markusklems,项目名称:aws-lambda-java-example,代码行数:29,代码来源:LambdaApprovalFunctionHandler.java


示例16: updateItem

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
@Override
  public UpdateItemResult updateItem(String tableName, HashMap<String, AttributeValue> primaryKey, Map<String, 
  		AttributeValueUpdate> updateItems) {
      Map<String, AttributeValueUpdate> attributeValueUpdates = new HashMap<String, AttributeValueUpdate>();
      attributeValueUpdates.putAll(updateItems);
      
      UpdateItemRequest updateItemRequest = new UpdateItemRequest()
          .withTableName(tableName)
          .withKey(primaryKey).withReturnValues(ReturnValue.UPDATED_NEW)
          .withAttributeUpdates(updateItems);
      
      UpdateItemResult updateItemResult = dynamoDBClient.updateItem(updateItemRequest);
LOG.info("Successful by updating item from " + tableName + ": " + updateItemResult); 
      return updateItemResult;
  }
 
开发者ID:dgks0n,项目名称:milton-aws,代码行数:16,代码来源:DynamoDBServiceImpl.java


示例17: update

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
/**
 * Update the Inventory table with the state of an Aggregator.
 * 
 * @param streamName The Kinesis Stream being aggregated.
 * @param applicationName The application name running the aggregator.
 * @param workerId The worker ID which encapsulates an instance of an
 *        Aggregator.
 * @param lastLowSeq The lowest sequence number observed in all records
 *        which were flushed prior to this update.
 * @param lastHighSeq The highest sequence number for all records flushed in
 *        this update.
 * @param lastWriteTime The write time of the data to Dynamo DB.
 * @param status The {@link STATE} of the Aggregator.
 * @throws Exception
 */
public void update(final String streamName, final String applicationName,
        final String namespace, final String shardId, final String lastLowSeq,
        final String lastHighSeq, final long lastWriteTime, final STATE status)
        throws Exception {
    // create the last write time value
    final String lastUpdateDateLabel = StreamAggregator.dateFormatter.format(new Date(
            lastWriteTime));
    // generate the item update
    Map<String, AttributeValueUpdate> inventoryUpdate = new HashMap<String, AttributeValueUpdate>() {
        {
            put(InventoryModel.LAST_WRITE_TIME,
                    new AttributeValueUpdate().withAction(AttributeAction.PUT).withValue(
                            new AttributeValue().withS(lastUpdateDateLabel)));
            if (lastLowSeq != null)
                put(InventoryModel.LAST_LOW_SEQ,
                        new AttributeValueUpdate().withAction(AttributeAction.PUT).withValue(
                                new AttributeValue().withS(lastLowSeq)));
            if (lastHighSeq != null)
                put(InventoryModel.LAST_HIGH_SEQ,
                        new AttributeValueUpdate().withAction(AttributeAction.PUT).withValue(
                                new AttributeValue().withS(lastHighSeq)));
            if (status != null)
                put(InventoryModel.STATUS,
                        new AttributeValueUpdate().withAction(AttributeAction.PUT).withValue(
                                new AttributeValue().withS(status.name())));
        }
    };
    DynamoUtils.updateWithRetries(
            dynamoClient,
            new UpdateItemRequest().withTableName(InventoryModel.TABLE_NAME).withKey(
                    getKey(streamName, applicationName, namespace, shardId)).withAttributeUpdates(
                    inventoryUpdate));
}
 
开发者ID:awslabs,项目名称:amazon-kinesis-aggregators,代码行数:49,代码来源:InventoryModel.java


示例18: updateAddNewAttribute

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
private static void updateAddNewAttribute() {
    try {
        HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>();
        key.put("Id", new AttributeValue().withN("121"));
     
        
        Map<String, AttributeValue> expressionAttributeValues = new HashMap<String, AttributeValue>();
        expressionAttributeValues.put(":val1", new AttributeValue().withS("Some value")); 
        
        ReturnValue returnValues = ReturnValue.ALL_NEW;
        
        UpdateItemRequest updateItemRequest = new UpdateItemRequest()
            .withTableName(tableName)
            .withKey(key)
            .withUpdateExpression("set NewAttribute = :val1")
            .withExpressionAttributeValues(expressionAttributeValues)
            .withReturnValues(returnValues);
        
        UpdateItemResult result = client.updateItem(updateItemRequest);
        
        // Check the response.
        System.out.println("Printing item after adding new attribute...");
        printItem(result.getAttributes());            
                        
    }   catch (AmazonServiceException ase) {
                System.err.println("Failed to add new attribute in " + tableName);
                System.err.println(ase.getMessage());
    }        
}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:30,代码来源:LowLevelItemCRUDExample.java


示例19: updateMultipleAttributes

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
private static void updateMultipleAttributes() {
    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(":val1", new AttributeValue().withSS("Author YY", "Author ZZ")); 
        expressionAttributeValues.put(":val2", new AttributeValue().withS("someValue")); 

        ReturnValue returnValues = ReturnValue.ALL_NEW;
        
        UpdateItemRequest updateItemRequest = new UpdateItemRequest()
            .withTableName(tableName)
            .withKey(key)
            .withUpdateExpression("add Authors :val1 set NewAttribute=:val2")
            .withExpressionAttributeValues(expressionAttributeValues)
            .withReturnValues(returnValues);
        
        UpdateItemResult result = client.updateItem(updateItemRequest);
        
        // Check the response.
        System.out.println("Printing item after multiple attribute update...");
        printItem(result.getAttributes());            
                        
    }   catch (AmazonServiceException ase) {
        System.err.println("Failed to update multiple attributes in " + tableName);
        System.out.println(ase.getMessage());  //DELETEME
        System.err.println("Failed to update multiple attributes in " + tableName); //DELETEME
    }
}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:32,代码来源:LowLevelItemCRUDExample.java


示例20: updateExistingAttributeConditionally

import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest; //导入依赖的package包/类
private static void updateExistingAttributeConditionally() {
    try {
        

        HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>();
        key.put("Id", new AttributeValue().withN("120"));

        // Specify the desired price (25.00) and also the condition (price = 20.00)
       
        Map<String, AttributeValue> expressionAttributeValues = new HashMap<String, AttributeValue>();
        expressionAttributeValues.put(":val1", new AttributeValue().withN("25.00")); 
        expressionAttributeValues.put(":val2", new AttributeValue().withN("20.00")); 
        
        ReturnValue returnValues = ReturnValue.ALL_NEW;

        UpdateItemRequest updateItemRequest = new UpdateItemRequest()
            .withTableName(tableName)
            .withKey(key)
            .withUpdateExpression("set Price = :val1")
            .withConditionExpression("Price = :val2")
            .withExpressionAttributeValues(expressionAttributeValues)
            .withReturnValues(returnValues);

        UpdateItemResult result = client.updateItem(updateItemRequest);
        
        // Check the response.
        System.out.println("Printing item after conditional update to new attribute...");
        printItem(result.getAttributes());            
    } catch (ConditionalCheckFailedException cse) {
        // Reload object and retry code.
        System.err.println("Conditional check failed in " + tableName);
    } catch (AmazonServiceException ase) {
        System.err.println("Error updating item in " + tableName);
    }        
}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:36,代码来源:LowLevelItemCRUDExample.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ScanResult类代码示例发布时间:2022-05-21
下一篇:
Java SecurityInfo类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap