Package com.amazonaws.services.dynamodb.model

Examples of com.amazonaws.services.dynamodb.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 if ( !nonKeyAttributePresent ) {
            keyOnlyPut(clazz, tableName, objectKey, hashKeyGetter, rangeKeyGetter);
        } else {
View Full Code Here


            String rangeKeyAttributeName = reflector.getAttributeName(rangeKeyGetter);
            attributes.put(rangeKeyAttributeName, objectKey.getRangeKeyElement());
            expectedValues.put(rangeKeyAttributeName, new ExpectedAttributeValue().withExists(false));
        }
        attributes = transformAttributes(clazz, attributes);
        db.putItem(applyUserAgent(new PutItemRequest().withTableName(tableName).withItem(attributes)
                .withExpected(expectedValues)));
    }
View Full Code Here

    public <T> void putObj(Class<T> modelClass, T dataObj, String expectedField, Object expectedValue, boolean expectedExists)
        throws Exception
    {
        String          modelName = jsoda.getModelName(modelClass);
        String          table = jsoda.getModelTable(modelName);
        PutItemRequest  req = new PutItemRequest(table, objToAttrs(dataObj, modelName));

        if (expectedField != null)
            req.setExpected(makeExpectedMap(modelName, expectedField, expectedValue, expectedExists));

        ddbClient.putItem(req);
    }
View Full Code Here

        logger.debug("insertkey: " + primaryKeyName + "-" + key + " from table: " + table);
        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());
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 if ( !nonKeyAttributePresent ) {
            keyOnlyPut(tableName, objectKey, hashKeyGetter, rangeKeyGetter);
        } else {
View Full Code Here

            String rangeKeyAttributeName = reflector.getAttributeName(rangeKeyGetter);
            attributes.put(rangeKeyAttributeName, objectKey.getRangeKeyElement());
            expectedValues.put(rangeKeyAttributeName, new ExpectedAttributeValue().withExists(false));
        }

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

           
            AttributeValue avPath = new AttributeValue(normalize(path.getParent()));
            AttributeValue avFile = new AttributeValue(path.getName());
            AttributeValue avEpoch = new AttributeValue().withN(epoch+"");
           
            PutItemRequest put = new PutItemRequest();
            put.setTableName(tableName);
            Map<String, AttributeValue> items = new HashMap<String, AttributeValue>();

            items.put(HASH_KEY, avPath);
            items.put(RANGE_KEY, avFile);
            items.put(EPOCH_VALUE, avEpoch);
           
            if(directory) {
                items.put(DIRECTORY_VALUE, new AttributeValue(Boolean.TRUE.toString()));
            }
           
            put.setItem(items);

            if(log.isDebugEnabled()) {
                log.debug("Adding metastore entry for: " + path.toUri());
            }

            db.putItem(put);

            PutItemRequest tsPut = new PutItemRequest();
            tsPut.setTableName(tableName);
            Map<String, AttributeValue> tsItems = new HashMap<String, AttributeValue>();
           
            tsItems.put(HASH_KEY, new AttributeValue(TIMESERIES_KEY));
            tsItems.put(RANGE_KEY, new AttributeValue(epoch+"-"+rand.nextInt()));
            tsItems.put(LINK_HASH_KEY, avPath);
            tsItems.put(LINK_RANGE_KEY, avFile);
            tsPut.setItem(tsItems);
           
            db.putItem(tsPut);
           
            return null;
        }
View Full Code Here

  public long addLog(String key, String log) throws Exception {
    long dateTime = new Date().getTime();
   
    String dateTimeStr = String.valueOf(dateTime);
   
        PutItemRequest putItemRequest = new PutItemRequest()
          .withTableName(tableName.get())
          .withItem(ImmutableMap.of(hashKeyName.get(), new AttributeValue(key),
                        rangeKeyName.get(), new AttributeValue(dateTimeStr),
                        valueName.get(), new AttributeValue(log)));
       
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(convertToItem(updateValues))
                    .withExpected(expectedValues)));
        } else if ( !nonKeyAttributePresent ) {
            keyOnlyPut(tableName, objectKey, hashKeyGetter, rangeKeyGetter);
        } else {
            db.updateItem(applyUserAgent(new UpdateItemRequest().withTableName(tableName).withKey(objectKey)
View Full Code Here

            String rangeKeyAttributeName = reflector.getAttributeName(rangeKeyGetter);
            attributes.put(rangeKeyAttributeName, objectKey.getRangeKeyElement());
            expectedValues.put(rangeKeyAttributeName, new ExpectedAttributeValue().withExists(false));
        }
       
        db.putItem(applyUserAgent(new PutItemRequest().withTableName(tableName).withItem(attributes)
                .withExpected(expectedValues)));
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.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.