Package com.amazonaws.services.dynamodb.model

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


                            //end put request
                            jsonWriter.endObject();
                        } else if (deleteRequest != null) {
                            //Begin delete request
                            jsonWriter.key("DeleteRequest").object();
                            Key key = deleteRequest.getKey();
                            if (key != null) {
                                //begin key
                                jsonWriter.key("Key").object();
                                AttributeValue hashKeyElemenet = key.getHashKeyElement();
                                AttributeValue rangeKeyElement = key.getRangeKeyElement();
                                if (hashKeyElemenet != null) {
                                    if (hashKeyElemenet.getN() != null) {
                                        jsonWriter.key("N").value(hashKeyElemenet.getN());
                                    } else if (hashKeyElemenet.getS() != null) {
                                        jsonWriter.key("S").value(hashKeyElemenet.getS());
View Full Code Here


          jsonWriter.endObject();
        }
        jsonWriter.endArray();
      }
      if (queryResult.getLastEvaluatedKey() != null) {
        Key key = queryResult.getLastEvaluatedKey();
        jsonWriter.key("LastEvaluatedKey").object();
        AttributeValue value;
        if (key.getHashKeyElement() != null) {
          jsonWriter.key("HashKeyElement").object();
          value = key.getHashKeyElement();
          if (value.getN() != null) {
            jsonWriter.key(value.getN()).value("N");
          } else if (value.getS() != null) {
            jsonWriter.key(value.getS()).value("S");
          }
          jsonWriter.endObject();
        }
        if (key.getRangeKeyElement() != null) {
          jsonWriter.key("RangeKeyElement").object();
          value = key.getRangeKeyElement();
          if (value.getN() != null) {
            jsonWriter.key(value.getN()).value("N");
          } else if (value.getS() != null) {
            jsonWriter.key(value.getS()).value("S");
          }
View Full Code Here

    public void queryUpdate() {
        // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
       
        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);
View Full Code Here

    public void accumulativeUpdate() {
        // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
       
        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);
View Full Code Here

    public void conditionalUpdateOnHit(){
      // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
       
        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);
View Full Code Here

    public void conditionalAddNewFieldUpdateOnHit(){
      // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
       
        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);
View Full Code Here

    public void conditionalPutNewFieldUpdateOnHit(){
      // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
       
        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);
View Full Code Here

    public void conditionalUpdateOnMissing(){
      // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
       
        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);
View Full Code Here

    public void conditionalDeleteOldFieldUpdateOnHit(){
      // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
       
        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));
       
View Full Code Here

        PutItemRequest req = new PutItemRequest().withTableName(tableName).withItem(item);
        getClient().putItem(req);

        //Prepare update
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));

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

TOP

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

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.