Package com.amazonaws.services.dynamodb.model

Examples of com.amazonaws.services.dynamodb.model.UpdateItemRequest


            db.putItem(applyUserAgent(new PutItemRequest().withTableName(tableName).withItem(convertToItem(updateValues))
                    .withExpected(expectedValues)));
        } else if ( !nonKeyAttributePresent ) {
            keyOnlyPut(tableName, objectKey, hashKeyGetter, rangeKeyGetter);
        } else {
            db.updateItem(applyUserAgent(new UpdateItemRequest().withTableName(tableName).withKey(objectKey)
                    .withAttributeUpdates(updateValues).withExpected(expectedValues)));
        }

        /*
         * Finally, after the service call has succeeded, update the in-memory
View Full Code Here


         */
        if ( config.getSaveBehavior() == SaveBehavior.CLOBBER || forcePut ) {
            db.putItem(applyUserAgent(new PutItemRequest().withTableName(tableName).withItem(convertToItem(updateValues))
                    .withExpected(expectedValues)));
        } else {
            db.updateItem(applyUserAgent(new UpdateItemRequest().withTableName(tableName).withKey(objectKey)
                    .withAttributeUpdates(updateValues).withExpected(expectedValues)));
        }

        /*
         * Finally, after the service call has succeeded, update the in-memory
View Full Code Here

                    .withItem(transformAttributes(clazz, convertToItem(updateValues)))
                    .withExpected(expectedValues)));
        } else if ( !nonKeyAttributePresent ) {
            keyOnlyPut(tableName, objectKey, hashKeyGetter, rangeKeyGetter);
        } else {
            db.updateItem(applyUserAgent(new UpdateItemRequest().withTableName(tableName).withKey(objectKey)
                    .withAttributeUpdates(transformAttributeUpdates(clazz, updateValues)).withExpected(expectedValues)));
        }

        /*
         * Finally, after the service call has succeeded, update the in-memory
View Full Code Here

                    .withItem(transformAttributes(clazz, convertToItem(updateValues)))
                    .withExpected(expectedValues)));
        } else if ( !nonKeyAttributePresent ) {
            keyOnlyPut(clazz, tableName, objectKey, hashKeyGetter, rangeKeyGetter);
        } else {
            db.updateItem(applyUserAgent(new UpdateItemRequest().withTableName(tableName).withKey(objectKey)
                                         .withAttributeUpdates(transformAttributeUpdates(clazz, objectKey, updateValues)).withExpected(expectedValues)));
        }

        /*
         * Finally, after the service call has succeeded, update the in-memory
View Full Code Here

            db.putItem(applyUserAgent(new PutItemRequest().withTableName(tableName).withItem(convertToItem(updateValues))
                    .withExpected(expectedValues)));
        } else if ( !nonKeyAttributePresent ) {
            keyOnlyPut(tableName, objectKey, hashKeyGetter, rangeKeyGetter);
        } else {
            db.updateItem(applyUserAgent(new UpdateItemRequest().withTableName(tableName).withKey(objectKey)
                    .withAttributeUpdates(updateValues).withExpected(expectedValues)));
        }

        /*
         * Finally, after the service call has succeeded, update the in-memory
View Full Code Here

                    .withItem(transformAttributes(clazz, convertToItem(updateValues)))
                    .withExpected(expectedValues)));
        } else if ( !nonKeyAttributePresent ) {
            keyOnlyPut(clazz, tableName, objectKey, hashKeyGetter, rangeKeyGetter);
        } else {
            db.updateItem(applyUserAgent(new UpdateItemRequest().withTableName(tableName).withKey(objectKey)
                                         .withAttributeUpdates(transformAttributeUpdates(clazz, objectKey, updateValues)).withExpected(expectedValues)));
        }

        /*
         * Finally, after the service call has succeeded, update the in-memory
View Full Code Here

    public static UpdateItemRequest MapV2UpdateItemRequestToV1(
            com.amazonaws.services.dynamodbv2.model.UpdateItemRequest v2Request,
            Table table) {

        UpdateItemRequest request =
            new UpdateItemRequest()
                .withTableName(v2Request.getTableName())
                .withKey(MapV2KeyToV1(v2Request.getKey(), table))
                .withAttributeUpdates(MapV2AttributeUpdatesToV1(v2Request.getAttributeUpdates()))
                .withExpected(MapV2ExpectedToV1(v2Request.getExpected()))
                .withReturnValues(v2Request.getReturnValues())
View Full Code Here

    return result;
  }

  public com.amazonaws.services.dynamodbv2.model.UpdateItemResult updateItemV2(com.amazonaws.services.dynamodbv2.model.UpdateItemRequest v2Request) {
        Table table = this.tables.get(v2Request.getTableName());
        UpdateItemRequest request = AlternatorDBApiVersion2Mapper.MapV2UpdateItemRequestToV1(v2Request, table);
    try {
      UpdateItemResult result = updateItem(request);
      return AlternatorDBApiVersion2Mapper.MapV1UpdateItemResultToV2(result, v2Request.getTableName());
    } catch (ConditionalCheckFailedException ccfev1) {
      throw new com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException(ccfev1.getMessage());
View Full Code Here

    public Boolean supports(Class clazz) {
        return UpdateItemRequest.class.isAssignableFrom(clazz);
    }

    public List<Error> validate(Object target) {
        UpdateItemRequest instance = (UpdateItemRequest) target;
      List<Error> errors = new ArrayList<Error>();
        errors.addAll(ValidatorUtils.invokeValidator(new TableNameValidator(), instance.getTableName()));
        errors.addAll(ValidatorUtils.invokeValidator(new KeyValidator(), instance.getKey()));
        errors.addAll(ValidatorUtils.rejectIfNullOrEmptyOrWhitespace(instance.getAttributeUpdates().toString()));
        return removeNulls(errors);
    }
View Full Code Here

import java.util.Map;

public class UpdateItemRequestJsonUnmarshaller implements Unmarshaller<UpdateItemRequest, JsonUnmarshallerContext> {

    public UpdateItemRequest unmarshall(JsonUnmarshallerContext context) throws Exception {
        UpdateItemRequest request = new UpdateItemRequest();

        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.currentToken;
        if (token == null) token = context.nextToken();
        while (true) {
            if (token == null) break;

            if (token == JsonToken.FIELD_NAME || token == JsonToken.START_OBJECT) {
                if (context.testExpression("TableName", targetDepth)) {
                    context.nextToken();
                    request.setTableName(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("Key", targetDepth)) {
                    request.setKey(KeyJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("Expected", targetDepth)) {
                  Map<String, ExpectedAttributeValue> expected = new MapUnmarshaller<String, ExpectedAttributeValue>(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance(), ExpectedAttributeValueJsonUnmarshaller.getInstance()).unmarshall(context);
                    request.setExpected(expected);
                }if (context.testExpression("AttributeUpdates", targetDepth)) {
                    request.setAttributeUpdates(new MapUnmarshaller<String, AttributeValueUpdate>(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance(), AttributeValueUpdateJsonUnmarshaller.getInstance()).unmarshall(context));
                }
            } else if (token == JsonToken.END_ARRAY || token == JsonToken.END_OBJECT) {
                if (context.getCurrentDepth() <= originalDepth) break;
            }
            token = context.nextToken();
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.model.UpdateItemRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.