Package com.amazonaws.services.dynamodbv2.model

Examples of com.amazonaws.services.dynamodbv2.model.PutItemRequest


        createGenericHashRangeTable(tableName);

    AttributeValue hashKey1 = createStringAttribute();
    AttributeValue hashKey2 = createStringAttribute();

    getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));

        getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createStringAttribute("Range4"), "attr1", "value14", "attr2", "value24")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createStringAttribute("Range3"), "attr1", "value13", "attr2", "value23")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createStringAttribute("Range2"), "attr1", "value12", "attr2", "value22")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createStringAttribute("Range1"), "attr1", "value11", "attr2", "value21")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createStringAttribute("AnotherRange1"), "attr1", "value19", "attr2", "value29")).withTableName(tableName));

    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createStringAttribute("AnotherRange1"), "attr1", "value19", "attr2", "value29")).withTableName(tableName));
        getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createStringAttribute("Range1"), "attr1", "value11", "attr2", "value21")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createStringAttribute("Range2"), "attr1", "value12", "attr2", "value22")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createStringAttribute("Range3"), "attr1", "value13", "attr2", "value23")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createStringAttribute("Range4"), "attr1", "value14", "attr2", "value24")).withTableName(tableName));

        getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));
        getClient().putItem(new PutItemRequest().withItem(createGenericItem()).withTableName(tableName));

        return hashKey1;
    }
View Full Code Here


        createTable(tableName, hashAttr, rangeAttr);

    AttributeValue hashKey1 = createStringAttribute();
    AttributeValue hashKey2 = createStringAttribute();

    getClient().putItem(new PutItemRequest().withItem(createGenericItem(createStringAttribute(), createNumberAttribute())).withTableName(tableName));

        getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createNumberAttribute(4), "attr1", "value14", "attr2", "value24")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createNumberAttribute(3), "attr1", "value13", "attr2", "value23")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createNumberAttribute(2), "attr1", "value12", "attr2", "value22")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createNumberAttribute(1), "attr1", "value11", "attr2", "value21")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createNumberAttribute(11), "attr1", "value11", "attr2", "value21")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey1, createNumberAttribute(51), "attr1", "value19", "attr2", "value29")).withTableName(tableName));

    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createNumberAttribute(51), "attr1", "value19", "attr2", "value29")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createNumberAttribute(11), "attr1", "value19", "attr2", "value29")).withTableName(tableName));
        getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createNumberAttribute(1), "attr1", "value11", "attr2", "value21")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createNumberAttribute(2), "attr1", "value12", "attr2", "value22")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createNumberAttribute(3), "attr1", "value13", "attr2", "value23")).withTableName(tableName));
    getClient().putItem(new PutItemRequest().withItem(createGenericItem(hashKey2, createNumberAttribute(4), "attr1", "value14", "attr2", "value24")).withTableName(tableName));

        getClient().putItem(new PutItemRequest().withItem(createGenericItem(createStringAttribute(), createNumberAttribute())).withTableName(tableName));
        getClient().putItem(new PutItemRequest().withItem(createGenericItem(createStringAttribute(), createNumberAttribute())).withTableName(tableName));

        return hashKey1;
    }
View Full Code Here

        attrs.put(DefaultDynamo.SECRET, new AttributeValue(domain.secret()));
        attrs.put(DefaultDynamo.REGION, new AttributeValue(domain.region()));
        attrs.put(DefaultDynamo.SYSLOG, new AttributeValue(domain.syslog()));
        attrs.put(DefaultDynamo.BUCKET, new AttributeValue(domain.bucket()));
        final AmazonDynamoDB amazon = this.client.get();
        amazon.putItem(new PutItemRequest(this.table, attrs));
        amazon.shutdown();
        return true;
    }
View Full Code Here

                    Map<String, AttributeValue> attributeValues =
                            convertToItem(getAttributeValueUpdates());

                    attributeValues = transformAttributes(
                        toParameters(attributeValues, this.clazz, finalConfig));
                    PutItemRequest req = new PutItemRequest()
                        .withTableName(getTableName())
                        .withItem(attributeValues)
                        .withExpected(getExpectedAttributeValues())
                        .withRequestMetricCollector(
                            finalConfig.getRequestMetricCollector());
View Full Code Here

        //overlay any user provided expected values.
        if(userProvidedExpectedValues != null){
            expectedValues.putAll(userProvidedExpectedValues);
        }
        PutItemRequest req = new PutItemRequest().withTableName(tableName)
            .withItem(attributes).withExpected(expectedValues)
            .withRequestMetricCollector(config.getRequestMetricCollector());
        db.putItem(applyUserAgent(req));
   }
View Full Code Here

                    Map<String, AttributeValue> attributeValues =
                            convertToItem(getAttributeValueUpdates());

                    attributeValues = transformAttributes(
                        toParameters(attributeValues, this.clazz, finalConfig));
                    PutItemRequest req = new PutItemRequest()
                        .withTableName(getTableName())
                        .withItem(attributeValues)
                        .withExpected(getExpectedAttributeValues())
                        .withRequestMetricCollector(
                            finalConfig.getRequestMetricCollector());
View Full Code Here

        //overlay any user provided expected values.
        if(userProvidedExpectedValues != null){
            expectedValues.putAll(userProvidedExpectedValues);
        }
        PutItemRequest req = new PutItemRequest().withTableName(tableName)
            .withItem(attributes).withExpected(expectedValues)
            .withRequestMetricCollector(config.getRequestMetricCollector());
        db.putItem(applyUserAgent(req));
   }
View Full Code Here

    if (StringUtils.isBlank(key) || StringUtils.isBlank(cf) || row == null || row.isEmpty()) {
      return null;
    }
    try {
      setRowKey(key, row);
      PutItemRequest putItemRequest = new PutItemRequest(cf, row);
      client().putItem(putItemRequest);
    } catch (Exception e) {
      logger.error(null, e);
    }
    return key;
View Full Code Here

        /*
         * Do a put or an update, according to the configuration. For a put (not
         * the default), we need to munge the data type.
         */
        if ( config.getSaveBehavior() == SaveBehavior.CLOBBER || forcePut ) {
            db.putItem(applyUserAgent(new PutItemRequest().withTableName(tableName)
                    .withItem(transformAttributes(clazz, convertToItem(updateValues)))
                    .withExpected(expectedValues)));
        } else {
            db.updateItem(applyUserAgent(new UpdateItemRequest().withTableName(tableName).withKey(key)
                    .withAttributeUpdates(transformAttributeUpdates(clazz, key, updateValues)).withExpected(expectedValues)));
View Full Code Here

                }

                @Override
                protected void executeLowLevelRequest(boolean onlyKeyAttributeSpecified) {
                    /* Send a putItem request */
                    db.putItem(applyUserAgent(new PutItemRequest().withTableName(getTableName())
                            .withItem(transformAttributes(this.clazz, convertToItem(getAttributeValueUpdates())))
                            .withExpected(getExpectedAttributeValues())));
                }
            };
        } else {
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.model.PutItemRequest

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.