Package com.amazonaws.services.dynamodb.model

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


    }

    public static AttributeValueUpdate MapV2AttributeValueUpdateToV1(
            com.amazonaws.services.dynamodbv2.model.AttributeValueUpdate v2AttrUpdate) {

        AttributeValueUpdate v1AttrUpdate =
            new AttributeValueUpdate()
                .withValue(MapV2AttributeValueToV1(v2AttrUpdate.getValue()))
                .withAction(v2AttrUpdate.getAction())
                ;
        return v1AttrUpdate;
    }
View Full Code Here


        Map<String, AttributeValueUpdate> v1AttrUpdates = null;
        if (v2AttrUpdates != null) {
            v1AttrUpdates = new HashMap<String, AttributeValueUpdate>();
            for (String key : v2AttrUpdates.keySet()) {
                com.amazonaws.services.dynamodbv2.model.AttributeValueUpdate v2AttrUpdate = v2AttrUpdates.get(key);
                AttributeValueUpdate v1AttrUpdate = MapV2AttributeValueUpdateToV1(v2AttrUpdate);
                v1AttrUpdates.put(key, v1AttrUpdate);
            }
        }
        return v1AttrUpdates;
    }
View Full Code Here

import com.fasterxml.jackson.core.JsonToken;

public class AttributeValueUpdateJsonUnmarshaller implements Unmarshaller<AttributeValueUpdate, JsonUnmarshallerContext> {

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

        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("Value", targetDepth)) {
                    request.setValue(AttributeValueJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("Action", targetDepth)) {
                    context.nextToken();
                    request.setAction(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.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

       
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));
       
        Map<String, AttributeValueUpdate> dynValues = new HashMap<String, AttributeValueUpdate> ();
        dynValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("100"), AttributeAction.ADD));
       
        UpdateItemRequest update = new UpdateItemRequest(tableName, key, dynValues);
       
        getClient().updateItem(update);
View Full Code Here

       
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));
       
        Map<String, AttributeValueUpdate> dynValues = new HashMap<String, AttributeValueUpdate> ();
        dynValues.put("count", new AttributeValueUpdate(new AttributeValue().withNS("100"), AttributeAction.ADD));
       
        UpdateItemRequest update = new UpdateItemRequest(tableName, key, dynValues);
       
        getClient().updateItem(update);
       
        //second update
        dynValues = new HashMap<String, AttributeValueUpdate> ();
        dynValues.put("count", new AttributeValueUpdate(new AttributeValue().withNS("102"), AttributeAction.ADD));
        update = new UpdateItemRequest(tableName, key, dynValues);       
        getClient().updateItem(update);

        inProcessClient.save(PERSISTENCE_PATH);
        createNewInProcessClient().restore(PERSISTENCE_PATH);
View Full Code Here

       
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));
       
        Map<String, AttributeValueUpdate> oldValues = new HashMap<String, AttributeValueUpdate> ();
        oldValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("100"), AttributeAction.PUT));
       
        UpdateItemRequest update = new UpdateItemRequest(tableName, key, oldValues);
       
        getClient().updateItem(update);
       
        //conditional update
        HashMap<String, AttributeValueUpdate> newValues = new HashMap<String, AttributeValueUpdate> ();
        newValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("102"), AttributeAction.PUT));
       
        HashMap<String, ExpectedAttributeValue> expectedValues = new HashMap<String, ExpectedAttributeValue> ();
        expectedValues.put("count", new ExpectedAttributeValue().withValue(new AttributeValue().withN("100")));
       
        update = new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(newValues).withExpected(expectedValues);       
View Full Code Here

       
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));
       
        Map<String, AttributeValueUpdate> oldValues = new HashMap<String, AttributeValueUpdate> ();
        oldValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("100"), AttributeAction.PUT));
       
        UpdateItemRequest update = new UpdateItemRequest(tableName, key, oldValues);
       
        getClient().updateItem(update);
       
        //conditional update
        HashMap<String, AttributeValueUpdate> newValues = new HashMap<String, AttributeValueUpdate> ();
        newValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("102"), AttributeAction.PUT));
        newValues.put("ids", new AttributeValueUpdate(new AttributeValue().withS("[er, er]"), AttributeAction.ADD));
       
        HashMap<String, ExpectedAttributeValue> expectedValues = new HashMap<String, ExpectedAttributeValue> ();
        expectedValues.put("count", new ExpectedAttributeValue().withValue(new AttributeValue().withN("100")));
       
        update = new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(newValues).withExpected(expectedValues);       
View Full Code Here

       
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));
       
        Map<String, AttributeValueUpdate> oldValues = new HashMap<String, AttributeValueUpdate> ();
        oldValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("100"), AttributeAction.PUT));
       
        UpdateItemRequest update = new UpdateItemRequest(tableName, key, oldValues);
       
        getClient().updateItem(update);
       
        //conditional update
        HashMap<String, AttributeValueUpdate> newValues = new HashMap<String, AttributeValueUpdate> ();
        newValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("102"), AttributeAction.PUT));
        newValues.put("ids", new AttributeValueUpdate(new AttributeValue().withS("[er, er]"), AttributeAction.PUT));
       
        HashMap<String, ExpectedAttributeValue> expectedValues = new HashMap<String, ExpectedAttributeValue> ();
        expectedValues.put("count", new ExpectedAttributeValue().withValue(new AttributeValue().withN("100")));
       
        update = new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(newValues).withExpected(expectedValues);       
View Full Code Here

       
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));
       
        Map<String, AttributeValueUpdate> oldValues = new HashMap<String, AttributeValueUpdate> ();
        oldValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("100"), AttributeAction.PUT));
       
        UpdateItemRequest update = new UpdateItemRequest(tableName, key, oldValues);
       
        getClient().updateItem(update);
       
        //conditional update
        HashMap<String, AttributeValueUpdate> newValues = new HashMap<String, AttributeValueUpdate> ();
        newValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("102"), AttributeAction.PUT));
       
        HashMap<String, ExpectedAttributeValue> expectedValues = new HashMap<String, ExpectedAttributeValue> ();
        expectedValues.put("count", new ExpectedAttributeValue().withValue(new AttributeValue().withN("10")));
       
        update = new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(newValues).withExpected(expectedValues);
View Full Code Here

       
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));
       
        Map<String, AttributeValueUpdate> oldValues = new HashMap<String, AttributeValueUpdate> ();
        oldValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("100"), AttributeAction.PUT));
        oldValues.put("ids", new AttributeValueUpdate(new AttributeValue().withS("[er, er]"), AttributeAction.ADD));
       
        UpdateItemRequest update = new UpdateItemRequest(tableName, key, oldValues);
       
        getClient().updateItem(update);
       
        //conditional update
        HashMap<String, AttributeValueUpdate> newValues = new HashMap<String, AttributeValueUpdate> ();
        newValues.put("count", new AttributeValueUpdate(new AttributeValue().withN("102"), AttributeAction.PUT));
        newValues.put("ids", new AttributeValueUpdate(new AttributeValue().withS("[er, er]"), AttributeAction.DELETE));
       
        HashMap<String, ExpectedAttributeValue> expectedValues = new HashMap<String, ExpectedAttributeValue> ();
        expectedValues.put("count", new ExpectedAttributeValue().withValue(new AttributeValue().withN("100")));
       
        update = new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(newValues).withExpected(expectedValues);       
View Full Code Here

TOP

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

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.