Package com.amazonaws.services.dynamodb.model

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


    }

    @Override
    public PutItemResult putItem(PutItemRequest putItemRequest) {
        this.putItemRequest = putItemRequest;
        return new PutItemResult().withAttributes(getAttributes());
    }
View Full Code Here


        super(ddbClient, configuration, exchange);
    }

    @Override
    public void execute() {
        PutItemResult result = ddbClient.putItem(new PutItemRequest()
                .withTableName(determineTableName())
                .withItem(determineItem())
                .withExpected(determineUpdateCondition())
                .withReturnValues(determineReturnValues()));

        addAttributesToResult(result.getAttributes());
    }
View Full Code Here

        Map<String, AttributeValue> attributes = createAttributes(values);
        // adding primary key
        attributes.put(primaryKeyName, new AttributeValue(key));

        PutItemRequest putItemRequest = new PutItemRequest(table, attributes);
        PutItemResult res = null;
        try {
            res = dynamoDB.putItem(putItemRequest);
        }catch (AmazonServiceException ex) {
            logger.error(ex.getMessage());
            return SERVER_ERROR;
View Full Code Here

    Map<String, AttributeValue> item = table.getItem(hashKeyValue, rangeKeyValue);

    // Check conditional put
    validateExpected(request.getExpected(), item);

    PutItemResult result = new PutItemResult().withConsumedCapacityUnits(1D);
    if (item != null && request.getReturnValues() != null && ReturnValue.fromValue(request.getReturnValues()) == ReturnValue.ALL_OLD) {
      result.setAttributes(item);
    }

    // put the item in the table
    table.putItem(request.getItem());
View Full Code Here

    }

  public synchronized com.amazonaws.services.dynamodbv2.model.PutItemResult putItemV2(com.amazonaws.services.dynamodbv2.model.PutItemRequest v2Request) throws InternalServerErrorException, ResourceNotFoundException, ConditionalCheckFailedException {
        PutItemRequest request = AlternatorDBApiVersion2Mapper.MapV2PutItemRequestToV1(v2Request);
        try {
            PutItemResult result = putItem(request);
            return AlternatorDBApiVersion2Mapper.MapV1PutItemResultToV2(result, v2Request.getTableName());
        } catch (ConditionalCheckFailedException ex) {
            throw new com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException(ex.getMessage());
        }
  }
View Full Code Here

    @Test
    public void putItemWithHashKey() {
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        PutItemRequest request = new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
        PutItemResult res = getClient().putItem(request);
        Assert.assertNotNull(res);
        Assert.assertNotNull(res.getConsumedCapacityUnits());
    }
View Full Code Here

    public void putItemWithHashKeyOverwriteItem() {
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        PutItemRequest request = new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
        getClient().putItem(request); // put item beforehand
        PutItemResult res = getClient().putItem(request); // Add another
        Assert.assertNotNull(res);
        Assert.assertNotNull(res.getConsumedCapacityUnits());
    }
View Full Code Here

    public void putItemWithHashKeyAndRangeKey() {
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        schema.setRangeKeyElement(new KeySchemaElement().withAttributeName("range").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        PutItemRequest request = new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
        PutItemResult res = getClient().putItem(request);
        Assert.assertNotNull(res);
        Assert.assertNotNull(res.getConsumedCapacityUnits());
    }
View Full Code Here

        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        schema.setRangeKeyElement(new KeySchemaElement().withAttributeName("range").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        PutItemRequest request = new PutItemRequest().withTableName(tableName).withItem(createGenericItem());
        getClient().putItem(request); // put item beforehand
        PutItemResult res = getClient().putItem(request); // Add another
        Assert.assertNotNull(res);
        Assert.assertNotNull(res.getConsumedCapacityUnits());
    }
View Full Code Here

TOP

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

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.