Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 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.internal;
 
 import java.util.Map;
 
The implementation for DeleteItemApi.
 
 public class DeleteItemImpl extends AbstractImpl implements DeleteItemApi {
     public DeleteItemImpl(AmazonDynamoDB clientTable table) {
         super(clienttable);
     }
 
     @Override
     public DeleteItemOutcome deleteItem(KeyAttribute... primaryKeyComponents) {
         return doDeleteItem(new DeleteItemSpec()
             .withPrimaryKey(primaryKeyComponents));
     }
 
     @Override
     public DeleteItemOutcome deleteItem(PrimaryKey primaryKey) {
         return doDeleteItem(new DeleteItemSpec()
                 .withPrimaryKey(primaryKey));
     }
 
     @Override
     public DeleteItemOutcome deleteItem(PrimaryKey primaryKeys,
             Expected... expected) {
         return doDeleteItem(new DeleteItemSpec()
                 .withPrimaryKey(primaryKeys)
                 .withExpected(expected));
     }
 
     @Override
     public DeleteItemOutcome deleteItem(PrimaryKey primaryKeys,
             String conditionExpressionMap<StringStringnameMap,
             Map<StringObjectvalueMap) {
         return doDeleteItem(new DeleteItemSpec()
             .withPrimaryKey(primaryKeys)
             .withConditionExpression(conditionExpression)
             .withNameMap(nameMap)
             .withValueMap(valueMap))
             ;
     }
 
     @Override
     public DeleteItemOutcome deleteItem(DeleteItemSpec spec) {
         return doDeleteItem(spec);
     }
 
     private DeleteItemOutcome doDeleteItem(DeleteItemSpec spec) {
         // set the table name
         final String tableName = getTable().getTableName();
         // set up the keys
         DeleteItemRequest req = spec.getRequest().withTableName(tableName)
             .withKey(InternalUtils.toAttributeValueMap(spec.getKeyComponents()));
         // set up the expected attribute map, if any
         final Collection<Expectedexpected = spec.getExpected();
         final Map<StringExpectedAttributeValueexpectedMap =
             InternalUtils.toExpectedAttributeValueMap(expected);
         // set up the value map, if any (when expression API is used)
         final Map<String,AttributeValueattrValMap =
             InternalUtils.fromSimpleMap(spec.getValueMap());
         // set up the request
         req.withExpected(expectedMap)
            .withExpressionAttributeNames(spec.getNameMap())
            .withExpressionAttributeValues(attrValMap)
            ;
         DeleteItemResult result = getClient().deleteItem(req);
         return new DeleteItemOutcome(result);
     }
 
    @Override
    public DeleteItemOutcome deleteItem(String hashKeyNameObject hashKeyValue) {
        return deleteItem(new PrimaryKey(hashKeyNamehashKeyValue));
    }
    @Override
    public DeleteItemOutcome deleteItem(String hashKeyName,
            Object hashKeyValueString rangeKeyNameObject rangeKeyValue) {
        return deleteItem(
            new PrimaryKey(hashKeyNamehashKeyValue,  rangeKeyNamerangeKeyValue));
    }
    @Override
    public DeleteItemOutcome deleteItem(String hashKeyName,
            Object hashKeyValueExpected... expected) {
        return deleteItem(new PrimaryKey(hashKeyNamehashKeyValue), expected);
    }
    @Override
    public DeleteItemOutcome deleteItem(String hashKeyName,
            Object hashKeyValueString rangeKeyNameObject rangeKeyValue,
            Expected... expected) {
        return deleteItem(
                new PrimaryKey(hashKeyNamehashKeyValue,  rangeKeyNamerangeKeyValue),
                    expected);
    }
    @Override
    public DeleteItemOutcome deleteItem(String hashKeyName,
            Object hashKeyValueString conditionExpression,
            Map<StringStringnameMapMap<StringObjectvalueMap) {
        return deleteItem(new PrimaryKey(hashKeyNamehashKeyValue),
                    conditionExpressionnameMapvalueMap);
    }
    @Override
    public DeleteItemOutcome deleteItem(String hashKeyName,
            Object hashKeyValueString rangeKeyNameObject rangeKeyValue,
            String conditionExpressionMap<StringStringnameMap,
            Map<StringObjectvalueMap) {
        return deleteItem(
                new PrimaryKey(hashKeyNamehashKeyValue,  rangeKeyNamerangeKeyValue),
                    conditionExpressionnameMapvalueMap);
    }
New to GrepCode? Check out our FAQ X