Example usage for com.amazonaws.services.dynamodbv2.datamodeling DynamoDBMapper save

List of usage examples for com.amazonaws.services.dynamodbv2.datamodeling DynamoDBMapper save

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.datamodeling DynamoDBMapper save.

Prototype

@Override
    public <T> void save(T object, DynamoDBSaveExpression saveExpression) 

Source Link

Usage

From source file:com.github.sporcina.mule.modules.DynamoDBConnector.java

License:Open Source License

/**
 * Update document processor/*from w w  w .j av a 2 s .  c  o  m*/
 * <p/>
 * {@sample.xml ../../../doc/DynamoDB-connector.xml.sample dynamodb:update-document}
 *
 * @param tableName
 *         the table to update
 * @param document
 *         the object to save to the table as a document.  If not explicitly provided, it defaults to PAYLOAD.
 *
 * @return Object the place that was stored
 */
@Processor
public Object updateDocument(final String tableName, @Optional @Default(PAYLOAD) final Object document) {
    DynamoDBMapperConfig config = new DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior.UPDATE);
    DynamoDBMapper mapper = getDbObjectMapper(tableName);
    mapper.save(document, config);

    // save does not return the modified document.  Just return the original.
    return document;
}

From source file:com.kirana.dao.OrderDaoImpl.java

@Override
public boolean updateOrder(Order order) throws Exception {
    boolean status = false;
    DynamoDBMapper mapper = new DynamoDBMapper(dbClient);
    mapper.save(order, new DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior.UPDATE_SKIP_NULL_ATTRIBUTES));
    status = true;/*from   ww  w  .java2 s.co m*/
    return status;
}