View Javadoc

1   package edu.memphis.iis.demosurvey;
2   
3   import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
4   import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
5   import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIgnore;
6   import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;
7   
8   /**
9    * Our very simple model class
10   */
11  @DynamoDBTable(tableName="Survey")
12  public class Survey {
13  	protected String participantCode;
14  	protected String favoriteDogBreed;
15  	protected boolean catLover;
16  	protected int favoriteNumber;
17  
18  	public Survey() {
19  		//No set up action
20  	}
21  
22  	/**
23  	 * Insure that the current instance is valid for writing to the
24  	 * data store
25  	 * @return true if valid
26  	 */
27  	@DynamoDBIgnore // We don't want this stored in the DB
28  	public boolean isValid() {
29  		if (Utils.isBlankString(participantCode)) {
30  			return false;
31  		}
32  		return true;
33  	}
34  
35  	@DynamoDBHashKey(attributeName="participantCode")
36  	public String getParticipantCode() {
37  		return participantCode;
38  	}
39  	public void setParticipantCode(String participantCode) {
40  		this.participantCode = participantCode;
41  	}
42  
43  	@DynamoDBAttribute(attributeName="favoriteDogBreed")
44  	public String getFavoriteDogBreed() {
45  		return favoriteDogBreed;
46  	}
47  	public void setFavoriteDogBreed(String favoriteDogBreed) {
48  		this.favoriteDogBreed = favoriteDogBreed;
49  	}
50  
51  	@DynamoDBAttribute(attributeName="catLover")
52  	public boolean isCatLover() {
53  		return catLover;
54  	}
55  	public void setCatLover(boolean catLover) {
56  		this.catLover = catLover;
57  	}
58  
59  	@DynamoDBAttribute(attributeName="favoriteNumber")
60  	public int getFavoriteNumber() {
61  		return favoriteNumber;
62  	}
63  	public void setFavoriteNumber(int favoriteNumber) {
64  		this.favoriteNumber = favoriteNumber;
65  	}
66  }