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

com.amazonaws.services.simpledb.model.PutAttributesRequest Maven / Gradle / Ivy

Go to download

The Amazon Web Services SDK for Java provides Java APIs for building software on AWS' cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).

The newest version!
/*
 * Copyright 2010-2014 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;

import java.io.Serializable;

import com.amazonaws.AmazonWebServiceRequest;

/**
 * Container for the parameters to the {@link com.amazonaws.services.simpledb.AmazonSimpleDB#putAttributes(PutAttributesRequest) 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 PutAttributes or * 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
  • * *
* *

* * @see com.amazonaws.services.simpledb.AmazonSimpleDB#putAttributes(PutAttributesRequest) */ public class PutAttributesRequest extends AmazonWebServiceRequest implements Serializable { /** * 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 com.amazonaws.internal.ListWithAutoConstructFlag attributes; /** * 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. * * @param domainName The name of the domain in which to perform the * operation. * @param itemName The name of the item. * @param attributes The list of attributes. */ public PutAttributesRequest(String domainName, String itemName, java.util.List attributes) { setDomainName(domainName); setItemName(itemName); setAttributes(attributes); } /** * Constructs a new PutAttributesRequest object. * Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param domainName The name of the domain in which to perform the * operation. * @param itemName The name of the item. * @param attributes The list of attributes. * @param 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 domainName, String itemName, java.util.List attributes, UpdateCondition expected) { setDomainName(domainName); setItemName(itemName); setAttributes(attributes); setExpected(expected); } /** * The name of the domain in which to perform the operation. * * @return The name of the domain in which to perform the operation. */ public String getDomainName() { return domainName; } /** * The name of the domain in which to perform the operation. * * @param domainName The name of the domain in which to perform the operation. */ public void setDomainName(String domainName) { this.domainName = 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. * * @param domainName The name of the domain in which to perform the operation. * * @return A reference to this updated object so that method calls can be chained * together. */ public PutAttributesRequest withDomainName(String domainName) { this.domainName = domainName; return this; } /** * The name of the item. * * @return The name of the item. */ public String getItemName() { return itemName; } /** * The name of the item. * * @param itemName The name of the item. */ public void setItemName(String itemName) { this.itemName = itemName; } /** * The name of the item. *

* Returns a reference to this object so that method calls can be chained together. * * @param itemName The name of the item. * * @return A reference to this updated object so that method calls can be chained * together. */ public PutAttributesRequest withItemName(String itemName) { this.itemName = itemName; return this; } /** * The list of attributes. * * @return The list of attributes. */ public java.util.List getAttributes() { if (attributes == null) { attributes = new com.amazonaws.internal.ListWithAutoConstructFlag(); attributes.setAutoConstruct(true); } return attributes; } /** * The list of attributes. * * @param attributes The list of attributes. */ public void setAttributes(java.util.Collection attributes) { if (attributes == null) { this.attributes = null; return; } com.amazonaws.internal.ListWithAutoConstructFlag attributesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag(attributes.size()); attributesCopy.addAll(attributes); this.attributes = attributesCopy; } /** * The list of attributes. *

* Returns a reference to this object so that method calls can be chained together. * * @param attributes The list of attributes. * * @return A reference to this updated object so that method calls can be chained * together. */ public PutAttributesRequest withAttributes(ReplaceableAttribute... attributes) { if (getAttributes() == null) setAttributes(new java.util.ArrayList(attributes.length)); 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. * * @param attributes The list of attributes. * * @return A reference to this updated object so that method calls can be chained * together. */ public PutAttributesRequest withAttributes(java.util.Collection attributes) { if (attributes == null) { this.attributes = null; } else { com.amazonaws.internal.ListWithAutoConstructFlag attributesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag(attributes.size()); attributesCopy.addAll(attributes); this.attributes = 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. * * @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. */ public UpdateCondition getExpected() { return 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. * * @param 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 = 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. * * @param 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. * * @return A reference to this updated object so that method calls can be chained * together. */ public PutAttributesRequest withExpected(UpdateCondition expected) { this.expected = expected; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getDomainName() != null) sb.append("DomainName: " + getDomainName() + ","); if (getItemName() != null) sb.append("ItemName: " + getItemName() + ","); if (getAttributes() != null) sb.append("Attributes: " + getAttributes() + ","); if (getExpected() != null) sb.append("Expected: " + getExpected() ); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDomainName() == null) ? 0 : getDomainName().hashCode()); hashCode = prime * hashCode + ((getItemName() == null) ? 0 : getItemName().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); hashCode = prime * hashCode + ((getExpected() == null) ? 0 : getExpected().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PutAttributesRequest == false) return false; PutAttributesRequest other = (PutAttributesRequest)obj; if (other.getDomainName() == null ^ this.getDomainName() == null) return false; if (other.getDomainName() != null && other.getDomainName().equals(this.getDomainName()) == false) return false; if (other.getItemName() == null ^ this.getItemName() == null) return false; if (other.getItemName() != null && other.getItemName().equals(this.getItemName()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; if (other.getExpected() == null ^ this.getExpected() == null) return false; if (other.getExpected() != null && other.getExpected().equals(this.getExpected()) == false) return false; return true; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy