Example usage for com.amazonaws.services.dynamodbv2.model AttributeAction DELETE

List of usage examples for com.amazonaws.services.dynamodbv2.model AttributeAction DELETE

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model AttributeAction DELETE.

Prototype

AttributeAction DELETE

To view the source code for com.amazonaws.services.dynamodbv2.model AttributeAction DELETE.

Click Source Link

Usage

From source file:com.amazon.janusgraph.diskstorage.dynamodb.builder.SingleUpdateBuilder.java

License:Open Source License

private SingleUpdateBuilder delete(final StaticBuffer column) {
    updates.put(encodeKeyBuffer(column), new AttributeValueUpdate().withAction(AttributeAction.DELETE));
    return this;
}

From source file:com.clicktravel.infrastructure.persistence.aws.dynamodb.DynamoDbTemplate.java

License:Apache License

private Map<String, AttributeValueUpdate> getAttributeUpdateMap(final Item item,
        final ItemConfiguration itemConfiguration, final Long version) {
    final Map<String, AttributeValueUpdate> attributeMap = new HashMap<>();
    for (final PropertyDescriptor propertyDescriptor : itemConfiguration.propertyDescriptors()) {
        final String propertyName = propertyDescriptor.getName();
        if (propertyName.equals(VERSION_ATTRIBUTE)) {
            attributeMap.put(propertyName, new AttributeValueUpdate().withAction(AttributeAction.PUT)
                    .withValue(new AttributeValue().withN(String.valueOf(version))));
        } else if (propertyDescriptor.getWriteMethod() != null) {
            final AttributeValue attributeValue = DynamoDbPropertyMarshaller.getValue(item, propertyDescriptor);
            if (attributeMap != null) {
                // TODO Only add to attribute map if there is a difference
                if (attributeValue != null) {
                    attributeMap.put(propertyName, new AttributeValueUpdate().withAction(AttributeAction.PUT)
                            .withValue(attributeValue));
                } else {
                    attributeMap.put(propertyName,
                            new AttributeValueUpdate().withAction(AttributeAction.DELETE));
                }//  ww w  .  j  a v a  2  s.  co m
            }
        }
    }
    if (VariantItemConfiguration.class.isAssignableFrom(itemConfiguration.getClass())) {
        final VariantItemConfiguration variantItemConfiguration = (VariantItemConfiguration) itemConfiguration;
        attributeMap.put(variantItemConfiguration.parentItemConfiguration().discriminator(),
                new AttributeValueUpdate().withAction(AttributeAction.PUT)
                        .withValue(new AttributeValue(variantItemConfiguration.discriminatorValue())));
    }
    return attributeMap;
}

From source file:com.dell.doradus.db.dynamodb.DDBTransaction.java

License:Apache License

private void updateRowColumnDeletes(String storeName, Map<String, AttributeValue> key, List<String> colNames) {
    Map<String, AttributeValueUpdate> attributeUpdates = new HashMap<>();
    for (String colName : colNames) {
        attributeUpdates.put(colName, new AttributeValueUpdate().withAction(AttributeAction.DELETE));
    }/*  w  ww  . ja  va2 s.c om*/
    m_service.updateRow(storeName, key, attributeUpdates);
}

From source file:com.rapid7.diskstorage.dynamodb.builder.SingleUpdateBuilder.java

License:Open Source License

public SingleUpdateBuilder delete(StaticBuffer column) {
    updates.put(encodeKeyBuffer(column), new AttributeValueUpdate().withAction(AttributeAction.DELETE));
    return this;
}

From source file:com.vivastream.security.oauth2.common.util.DynamoDBUtils.java

License:Apache License

public static void nullSafeUpdateS(Map<String, AttributeValueUpdate> updates, String column, String value) {
    if (value == null || value.length() == 0) {
        updates.put(column, new AttributeValueUpdate().withAction(AttributeAction.DELETE));
    } else {/*from  w  ww . j av a  2s. c  om*/
        updates.put(column, new AttributeValueUpdate(new AttributeValue(value), AttributeAction.PUT));
    }
}