Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010 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.simpledb.model;
Container for the parameters to the PutAttributes operation.

The PutAttributes operation creates or replaces attributes in an item. The client may specify new attributes using a combination of the Attribute.X.Name and Attribute.X.Value parameters. The client specifies the first attribute by the parameters Attribute.0.Name and Attribute.0.Value , the second attribute by the parameters Attribute.1.Name and Attribute.1.Value , and so on.

Attributes are uniquely identified in an item by their name/value combination. For example, a single item can have the attributes { "first_name", "first_value" } and { "first_name", second_value" } . However, it cannot have two attribute instances where both the Attribute.X.Name and Attribute.X.Value are the same.

Optionally, the requestor can supply the Replace parameter for each individual attribute. Setting this value to true causes the new attribute value to replace the existing attribute value(s). For example, if an item has the attributes { 'a', '1' } , { 'b', '2'} and { 'b', '3' } and the requestor calls PutAttributes using the attributes { 'b', '4' } with the Replace parameter set to true, the final attributes of the item are changed to { 'a', '1' } and { 'b', '4' } , which replaces the previous values of the 'b' attribute with the new value.

NOTE: Using PutAttributes to replace attribute values that do not exist will not result in an error response.

You cannot specify an empty string as an attribute name.

Because Amazon SimpleDB makes multiple copies of client data and uses an eventual consistency update model, an immediate GetAttributes or Select operation (read) immediately after a DeleteAttributes operation (write) might not return the updated data.

The following limitations are enforced for this operation:

  • 256 total attribute name-value pairs per item
  • One billion attributes per domain
  • 10 GB of total user data storage per domain

 
 public class PutAttributesRequest extends AmazonWebServiceRequest {

    
The name of the domain in which to perform the operation.
 
     private String domainName;

    
The name of the item.
 
     private String itemName;

    
The list of attributes.
 
     private java.util.List<ReplaceableAttributeattributes;

    
The update condition which, if specified, determines whether the specified attributes will be updated or not. The update condition must be satisfied in order for this request to be processed and the attributes to be updated.
 
    private UpdateCondition expected;

    
Default constructor for a new PutAttributesRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
    public PutAttributesRequest() {}
    
    
Constructs a new PutAttributesRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
domainName The name of the domain in which to perform the operation.
itemName The name of the item.
attributes The list of attributes.
    public PutAttributesRequest(String domainNameString itemNamejava.util.List<ReplaceableAttributeattributes) {
        this. = domainName;
        this. = itemName;
        this. = attributes;
    }
    
    
Constructs a new PutAttributesRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
domainName The name of the domain in which to perform the operation.
itemName The name of the item.
attributes The list of attributes.
expected The update condition which, if specified, determines whether the specified attributes will be updated or not. The update condition must be satisfied in order for this request to be processed and the attributes to be updated.
    public PutAttributesRequest(String domainNameString itemNamejava.util.List<ReplaceableAttributeattributesUpdateCondition expected) {
        this. = domainName;
        this. = itemName;
        this. = attributes;
        this. = expected;
    }
    
    
The name of the domain in which to perform the operation.

Returns:
The name of the domain in which to perform the operation.
    public String getDomainName() {
        return ;
    }
    
    
The name of the domain in which to perform the operation.

Parameters:
domainName The name of the domain in which to perform the operation.
    public void setDomainName(String domainName) {
        this. = domainName;
    }
    
    
The name of the domain in which to perform the operation.

Returns a reference to this object so that method calls can be chained together.

Parameters:
domainName The name of the domain in which to perform the operation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public PutAttributesRequest withDomainName(String domainName) {
        this. = domainName;
        return this;
    }
    
    
    
The name of the item.

Returns:
The name of the item.
    public String getItemName() {
        return ;
    }
    
    
The name of the item.

Parameters:
itemName The name of the item.
    public void setItemName(String itemName) {
        this. = itemName;
    }
    
    
The name of the item.

Returns a reference to this object so that method calls can be chained together.

Parameters:
itemName The name of the item.
Returns:
A reference to this updated object so that method calls can be chained together.
    public PutAttributesRequest withItemName(String itemName) {
        this. = itemName;
        return this;
    }
    
    
    
The list of attributes.

Returns:
The list of attributes.
        if ( == null) {
             = new java.util.ArrayList<ReplaceableAttribute>();
        }
        return ;
    }
    
    
The list of attributes.

Parameters:
attributes The list of attributes.
    public void setAttributes(java.util.Collection<ReplaceableAttributeattributes) {
        java.util.List<ReplaceableAttributeattributesCopy = new java.util.ArrayList<ReplaceableAttribute>();
        if (attributes != null) {
            attributesCopy.addAll(attributes);
        }
        this. = attributesCopy;
    }
    
    
The list of attributes.

Returns a reference to this object so that method calls can be chained together.

Parameters:
attributes The list of attributes.
Returns:
A reference to this updated object so that method calls can be chained together.
    public PutAttributesRequest withAttributes(ReplaceableAttribute... attributes) {
        for (ReplaceableAttribute value : attributes) {
            getAttributes().add(value);
        }
        return this;
    }
    
    
The list of attributes.

Returns a reference to this object so that method calls can be chained together.

Parameters:
attributes The list of attributes.
Returns:
A reference to this updated object so that method calls can be chained together.
        java.util.List<ReplaceableAttributeattributesCopy = new java.util.ArrayList<ReplaceableAttribute>();
        if (attributes != null) {
            attributesCopy.addAll(attributes);
        }
        this. = attributesCopy;
        return this;
    }
    
    
The update condition which, if specified, determines whether the specified attributes will be updated or not. The update condition must be satisfied in order for this request to be processed and the attributes to be updated.

Returns:
The update condition which, if specified, determines whether the specified attributes will be updated or not. The update condition must be satisfied in order for this request to be processed and the attributes to be updated.
    public UpdateCondition getExpected() {
        return ;
    }
    
    
The update condition which, if specified, determines whether the specified attributes will be updated or not. The update condition must be satisfied in order for this request to be processed and the attributes to be updated.

Parameters:
expected The update condition which, if specified, determines whether the specified attributes will be updated or not. The update condition must be satisfied in order for this request to be processed and the attributes to be updated.
    public void setExpected(UpdateCondition expected) {
        this. = expected;
    }
    
    
The update condition which, if specified, determines whether the specified attributes will be updated or not. The update condition must be satisfied in order for this request to be processed and the attributes to be updated.

Returns a reference to this object so that method calls can be chained together.

Parameters:
expected The update condition which, if specified, determines whether the specified attributes will be updated or not. The update condition must be satisfied in order for this request to be processed and the attributes to be updated.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = expected;
        return this;
    }
    
    
    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        sb.append("DomainName: " +  + ", ");
        sb.append("ItemName: " +  + ", ");
        sb.append("Attributes: " +  + ", ");
        sb.append("Expected: " +  + ", ");
        sb.append("}");
        return sb.toString();
    }
    
}
    
New to GrepCode? Check out our FAQ X