All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.dynamodbv2.document.api.UpdateItemApi Maven / Gradle / Ivy

/*
 * Copyright 2014-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.amazonaws.services.dynamodbv2.document.api;

import java.util.Collection;
import java.util.Map;

import com.amazonaws.annotation.ThreadSafe;

import com.amazonaws.services.dynamodbv2.document.AttributeUpdate;
import com.amazonaws.services.dynamodbv2.document.Expected;
import com.amazonaws.services.dynamodbv2.document.PrimaryKey;
import com.amazonaws.services.dynamodbv2.document.UpdateItemOutcome;
import com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec;

/**
 * A Table-centric UpdateItem API.
 */
@ThreadSafe
public interface UpdateItemApi {

    /**
     * Updates an item with the attributes specified.
     *
     * @param primaryKey
     *            primary key of the item to be updated
     * @param attributeUpdates
     *            attributes to be updated
     */
    public UpdateItemOutcome updateItem(PrimaryKey primaryKey,
            AttributeUpdate... attributeUpdates);

    public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue,
            AttributeUpdate... attributeUpdates);

    public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue,
            String rangeKeyName, Object rangeKeyValue,
            AttributeUpdate... attributeUpdates);

    /**
     * Updates an item with the attributes specified.
     *
     * @param primaryKey
     *            primary key of the item to be updated
     * @param expected
     *            the condition to match for the update to succeed.
     * @param attributeUpdates
     *            attributes to be updated
     */
    public UpdateItemOutcome updateItem(PrimaryKey primaryKey,
            Collection expected, AttributeUpdate... attributeUpdates);
    
    /**
     * Updates an item with the specified hash-only key and attributes.
     */
    public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue,
            Collection expected, AttributeUpdate... attributeUpdates);
    
    /**
     * Updates an item with the specified hash key, range key and attributes.
     */
    public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue,
            String rangeKeyName, Object rangeKeyValue,
            Collection expected, AttributeUpdate... attributeUpdates);

    /**
     * Performs an update on an item in the table using the given update
     * expression string.
     *
     * @param primaryKey
     *            primary key of the item to be updated
     * @param updateExpression
     *            the update expression that specifies the attributes to be
     *            updated.
     * @param nameMap
     *            the map containing the mapping between attribute names used in
     *            update expression and the actual name of the attributes
     * @param valueMap
     *            the map containing the mapping between the attribute value
     *            used in update expression and the actual value of the
     *            attribute
     */
    public UpdateItemOutcome updateItem(PrimaryKey primaryKey,
            String updateExpression, Map nameMap,
            Map valueMap);
    
    public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue,
            String updateExpression, Map nameMap,
            Map valueMap);
    
    public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue,
            String rangeKeyName, Object rangeKeyValue,
            String updateExpression, Map nameMap,
            Map valueMap);

    /**
     * Updates an item with the specified primary key using the given
     * update expression provided the condition expression evaluates to true.
     *
     * @param primaryKey
     *            primary key of the item to be updated
     * @param updateExpression
     *            the update expression that specifies the attributes to be
     *            updated.
     * @param conditionExpression
     *            the condition expression that specifies the condition that
     *            needs to be evaluated to true
     * @param nameMap
     *            the map containing the mapping between attribute names used in
     *            update and condition expression and the actual name of the
     *            attributes
     * @param valueMap
     *            the map containing the mapping between the attribute value
     *            used in update and condition expression and the actual value
     *            of the attribute
     */
    public UpdateItemOutcome updateItem(PrimaryKey primaryKey,
            String updateExpression, String conditionExpression,
            Map nameMap, Map valueMap);
    
    /**
     * Updates an item with the specified hash key using the given
     * update expression provided the condition expression evaluates to true.
     */
    public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue,
            String updateExpression, String conditionExpression,
            Map nameMap, Map valueMap);
    
    /**
     * Updates an item with the specified hash key and range key using the given
     * update expression provided the condition expression evaluates to true.
     */
    public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue,
            String rangeKeyName, Object rangeKeyValue,
            String updateExpression, String conditionExpression,
            Map nameMap, Map valueMap);

    /**
     * Performs an update on an item in the table by specifying all the details.
     *
     * @param updateItemSpec
     *            the update specification for the item to be updated.
     */
    public UpdateItemOutcome updateItem(UpdateItemSpec updateItemSpec);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy