Examples of PutItemRequest


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

                            convertToItem(getAttributeValueUpdates());
                   
                    attributeValues = transformAttributes(
                        toParameters(attributeValues, this.clazz, finalConfig));
                   
                    db.putItem(applyUserAgent(new PutItemRequest().withTableName(getTableName())
                            .withItem(attributeValues)
                            .withExpected(getExpectedAttributeValues())));
                }
            };
        } else {
View Full Code Here

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

        //overlay any user provided expected values.
        if(userProvidedExpectedValues != null){
            expectedValues.putAll(userProvidedExpectedValues);
        }

        db.putItem(applyUserAgent(new PutItemRequest().withTableName(tableName).withItem(attributes)
                .withExpected(expectedValues)));
    }
View Full Code Here

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

        /*
         * 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, updateValues)).withExpected(expectedValues)));
View Full Code Here

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

        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating lease " + lease);
        }

        PutItemRequest request = new PutItemRequest();
        request.setTableName(table);
        request.setItem(serializer.toDynamoRecord(lease));
        request.setExpected(serializer.getDynamoNonexistantExpectation());

        try {
            dynamoDBClient.putItem(request);
        } catch (ConditionalCheckFailedException e) {
            if (LOG.isDebugEnabled()) {
View Full Code Here

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

    }

    private PutItemOutcome doPutItem(PutItemSpec spec) {
        // set the table name
        String tableName = getTable().getTableName();
        PutItemRequest req = spec.getRequest().withTableName(tableName);
        // set up the item
        Item item = spec.getItem();
        final Map<String,AttributeValue> attributes = InternalUtils.toAttributeValues(item);
        // set up the expected attribute map, if any
        final Map<String, ExpectedAttributeValue> expectedMap =
            InternalUtils.toExpectedAttributeValueMap(spec.getExpected());
        // set up the value map, if any (when expression API is used)
        final Map<String,AttributeValue> attrValMap =
            InternalUtils.fromSimpleMap(spec.getValueMap());
        // set up the request
        req.withItem(attributes)
            .withConditionalOperator(spec.getConditionalOperator())
            .withConditionExpression(spec.getConditionExpression())
            .withExpected(expectedMap)
            .withExpressionAttributeNames(spec.getNameMap())
            .withExpressionAttributeValues(attrValMap)
View Full Code Here

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

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

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

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

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

  public PutPointResult putPoint(PutPointRequest putPointRequest) {
    long geohash = S2Manager.generateGeohash(putPointRequest.getGeoPoint());
    long hashKey = S2Manager.generateHashKey(geohash, config.getHashKeyLength());
    String geoJson = GeoJsonMapper.stringFromGeoObject(putPointRequest.getGeoPoint());

    PutItemRequest putItemRequest = putPointRequest.getPutItemRequest();
    putItemRequest.setTableName(config.getTableName());

    AttributeValue hashKeyValue = new AttributeValue().withN(String.valueOf(hashKey));
    putItemRequest.getItem().put(config.getHashKeyAttributeName(), hashKeyValue);
    putItemRequest.getItem().put(config.getRangeKeyAttributeName(), putPointRequest.getRangeKeyValue());
    AttributeValue geohashValue = new AttributeValue().withN(Long.toString(geohash));
    putItemRequest.getItem().put(config.getGeohashAttributeName(), geohashValue);
    AttributeValue geoJsonValue = new AttributeValue().withS(geoJson);
    putItemRequest.getItem().put(config.getGeoJsonAttributeName(), geoJsonValue);

    PutItemResult putItemResult = config.getDynamoDBClient().putItem(putItemRequest);
    PutPointResult putPointResult = new PutPointResult(putItemResult);

    return putPointResult;
View Full Code Here

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

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

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

                    toParameters(attributeValues,
                                 this.clazz,
                                 getTableName(),
                                 saveConfig));

            PutItemRequest req = new PutItemRequest()
                    .withTableName(getTableName())
                    .withItem(attributeValues)
                    .withExpected(mergeExpectedAttributeValueConditions())
                    .withConditionalOperator(userProvidedConditionOperator)
                    .withRequestMetricCollector(saveConfig.getRequestMetricCollector());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.