I have the following code in which I query SimpleDb to get a list of the items in my domain along with the "Favorited" attribute. Basically I am trying to update the users database to have the most recent amount of times each item has been "Favorited".
itemNames[] works out perfectly. However, I am having trouble pulling out the attribute. I get to setting List Attributes which ends up being [{Name: Favorited, AlternateNameEncoding: null, Value: 5, AlternateValueEncoding: null, }]. From here though, I don't know how to pull out the Value attribute.
End result I want favoritedValues[i] = 5
Also, it is possible that I am going about this the difficult way, is there an easier way to do it?
private void updateFavorites() {
AmazonClientManager clientManager = new AmazonClientManager();
AmazonSimpleDBClient aSDbClient = clientManager.sdb();
String domainName = "domain";
SelectRequest selectRequest2 = new SelectRequest( "select Favorited from `" + domainName + "`" ).withConsistentRead( true );
List values = aSDbClient.select( selectRequest2 ).getItems();
String[] itemNames = new String[ values.size() ];
String[] favoritedValues = new String[ values.size()];
for ( int i = 0; i < values.size(); i++ ) {
itemNames[ i ] = ((Item)values.get( i )).getName();
List attributes = ((Item)values.get( i )).getAttributes();
favoritedValues[i] = No idea what goes here
}
}
The Dev guide wasn't able to help me. Every time I searched for information via google I got information on ListViews which wasn't what I was looking for.