@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 + ((getAttributeNames() == null) ? 0 : getAttributeNames().hashCode()); hashCode = prime * hashCode + ((getConsistentRead() == null) ? 0 : getConsistentRead().hashCode()); return hashCode; }
/** * The names of the attributes. * * @param attributeNames * The names of the attributes. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAttributesRequest withAttributeNames(java.util.Collection<String> attributeNames) { setAttributeNames(attributeNames); return this; }
/** * Constructs a new GetAttributesRequest 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. */ public GetAttributesRequest(String domainName, String itemName) { setDomainName(domainName); setItemName(itemName); }
@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 + ((getAttributeNames() == null) ? 0 : getAttributeNames().hashCode()); hashCode = prime * hashCode + ((isConsistentRead() == null) ? 0 : isConsistentRead().hashCode()); return hashCode; }
/** * Gets the Item based on the item name field which is the same as id in SimpleJPA. * If the item doesn't exist then null is returned. * * @param db * @param domainName * @param itemName * @param consistentRead true to read consistently, false to use eventual consistency * @return * @throws AmazonClientException */ public static Item findItemById(AmazonSimpleDB db, String domainName, String itemName, boolean consistentRead) throws AmazonClientException { GetAttributesResult results = db.getAttributes(new GetAttributesRequest() .withConsistentRead(consistentRead) .withDomainName(domainName) .withItemName(itemName)); if(results.getAttributes().size() == 0) { return null; } Item item = new Item(itemName, results.getAttributes()); return item; } }
/** * The names of the attributes. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param attributeNames The names of the attributes. * * @return A reference to this updated object so that method calls can be chained * together. */ public GetAttributesRequest withAttributeNames(String... attributeNames) { if (getAttributeNames() == null) setAttributeNames(new java.util.ArrayList<String>(attributeNames.length)); for (String value : attributeNames) { getAttributeNames().add(value); } return this; }
/** * The name of the item. * * @param itemName * The name of the item. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAttributesRequest withItemName(String itemName) { setItemName(itemName); return this; }
/** * The name of the domain in which to perform the operation. * * @param domainName * The name of the domain in which to perform the operation. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAttributesRequest withDomainName(String domainName) { setDomainName(domainName); return this; }
/** * Determines whether or not strong consistency should be enforced when data is read from SimpleDB. If * <code>true</code>, any data previously written to SimpleDB will be returned. Otherwise, results will be * consistent eventually, and the client may not see data that was written immediately before your read. * * @param consistentRead * Determines whether or not strong consistency should be enforced when data is read from SimpleDB. If * <code>true</code>, any data previously written to SimpleDB will be returned. Otherwise, results will be * consistent eventually, and the client may not see data that was written immediately before your read. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAttributesRequest withConsistentRead(Boolean consistentRead) { setConsistentRead(consistentRead); return this; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetAttributesRequest == false) return false; GetAttributesRequest other = (GetAttributesRequest)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.getAttributeNames() == null ^ this.getAttributeNames() == null) return false; if (other.getAttributeNames() != null && other.getAttributeNames().equals(this.getAttributeNames()) == false) return false; if (other.isConsistentRead() == null ^ this.isConsistentRead() == null) return false; if (other.isConsistentRead() != null && other.isConsistentRead().equals(this.isConsistentRead()) == false) return false; return true; }
private void putAndDelete(String domainName, String oldAttributeName, String newAttributeName, List<Item> items) throws AmazonClientException { AmazonSimpleDB db = factory.getSimpleDb(); for (Item item : items) { GetAttributesResult getOldResults = db.getAttributes(new GetAttributesRequest().withDomainName(domainName).withConsistentRead(true).withItemName( item.getName()).withAttributeNames(oldAttributeName)); List<Attribute> oldAtts = getOldResults.getAttributes(); if (oldAtts.size() > 0) { Attribute oldAtt = oldAtts.get(0); List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>(); atts.add(new ReplaceableAttribute(newAttributeName, oldAtt.getValue(), true)); db.putAttributes(new PutAttributesRequest().withDomainName(domainName).withItemName(item.getName()).withAttributes(atts)); db.deleteAttributes(new DeleteAttributesRequest().withDomainName(domainName).withItemName(item.getName()).withAttributes(oldAtts)); } } }
/** * The name of the item. * * @param itemName * The name of the item. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAttributesRequest withItemName(String itemName) { setItemName(itemName); return this; }
/** * The name of the domain in which to perform the operation. * * @param domainName * The name of the domain in which to perform the operation. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAttributesRequest withDomainName(String domainName) { setDomainName(domainName); return this; }
/** * Determines whether or not strong consistency should be enforced when data is read from SimpleDB. If * <code>true</code>, any data previously written to SimpleDB will be returned. Otherwise, results will be * consistent eventually, and the client may not see data that was written immediately before your read. * * @param consistentRead * Determines whether or not strong consistency should be enforced when data is read from SimpleDB. If * <code>true</code>, any data previously written to SimpleDB will be returned. Otherwise, results will be * consistent eventually, and the client may not see data that was written immediately before your read. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAttributesRequest withConsistentRead(Boolean consistentRead) { setConsistentRead(consistentRead); return this; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetAttributesRequest == false) return false; GetAttributesRequest other = (GetAttributesRequest) 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.getAttributeNames() == null ^ this.getAttributeNames() == null) return false; if (other.getAttributeNames() != null && other.getAttributeNames().equals(this.getAttributeNames()) == false) return false; if (other.getConsistentRead() == null ^ this.getConsistentRead() == null) return false; if (other.getConsistentRead() != null && other.getConsistentRead().equals(this.getConsistentRead()) == false) return false; return true; }
/** * 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 (getAttributeNames() != null) sb.append("AttributeNames: " + getAttributeNames() + ","); if (isConsistentRead() != null) sb.append("ConsistentRead: " + isConsistentRead() ); sb.append("}"); return sb.toString(); }
/** * Constructs a new GetAttributesRequest 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. */ public GetAttributesRequest(String domainName, String itemName) { setDomainName(domainName); setItemName(itemName); }
/** * The names of the attributes. * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setAttributeNames(java.util.Collection)} or {@link #withAttributeNames(java.util.Collection)} if you want * to override the existing values. * </p> * * @param attributeNames * The names of the attributes. * @return Returns a reference to this object so that method calls can be chained together. */ public GetAttributesRequest withAttributeNames(String... attributeNames) { if (this.attributeNames == null) { setAttributeNames(new com.amazonaws.internal.SdkInternalList<String>(attributeNames.length)); } for (String ele : attributeNames) { this.attributeNames.add(ele); } return this; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @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: ").append(getDomainName()).append(","); if (getItemName() != null) sb.append("ItemName: ").append(getItemName()).append(","); if (getAttributeNames() != null) sb.append("AttributeNames: ").append(getAttributeNames()).append(","); if (getConsistentRead() != null) sb.append("ConsistentRead: ").append(getConsistentRead()); sb.append("}"); return sb.toString(); }
request.addParameter("Version", "2009-04-15"); if (getAttributesRequest.getDomainName() != null) { request.addParameter("DomainName", StringUtils.fromString(getAttributesRequest.getDomainName())); if (getAttributesRequest.getItemName() != null) { request.addParameter("ItemName", StringUtils.fromString(getAttributesRequest.getItemName())); java.util.List<String> attributeNamesList = getAttributesRequest.getAttributeNames(); int attributeNamesListIndex = 1; if (getAttributesRequest.isConsistentRead() != null) { request.addParameter("ConsistentRead", StringUtils.fromBoolean(getAttributesRequest.isConsistentRead()));